mirror of
https://github.com/holub/mame
synced 2025-04-24 01:11:11 +03:00
borrow string processing code from ui.cpp so that £ works in layouts (using UTF-8 encoding at least) [David Haywood]
updated sc4fd7tha.lay with UTF8 encoding of £ sign [Krick]
This commit is contained in:
parent
ad04466a33
commit
27d55acdff
@ -942,11 +942,22 @@ void layout_element::component::draw_text(running_machine &machine, bitmap_argb3
|
||||
bitmap_argb32 tempbitmap(dest.width(), dest.height());
|
||||
|
||||
// loop over characters
|
||||
for (const char *s = m_string.c_str(); *s != 0; s++)
|
||||
const char *origs = m_string.c_str();
|
||||
const char *ends = origs + strlen(origs);
|
||||
const char *s = origs;
|
||||
unicode_char schar;
|
||||
|
||||
// loop over characters
|
||||
while (*s != 0)
|
||||
{
|
||||
int scharcount = uchar_from_utf8(&schar, s, ends - s);
|
||||
|
||||
if (scharcount == -1)
|
||||
break;
|
||||
|
||||
// get the font bitmap
|
||||
rectangle chbounds;
|
||||
font->get_scaled_bitmap_and_bounds(tempbitmap, bounds.height(), aspect, *s, chbounds);
|
||||
font->get_scaled_bitmap_and_bounds(tempbitmap, bounds.height(), aspect, schar, chbounds);
|
||||
|
||||
// copy the data into the target
|
||||
for (int y = 0; y < chbounds.height(); y++)
|
||||
@ -977,7 +988,8 @@ void layout_element::component::draw_text(running_machine &machine, bitmap_argb3
|
||||
}
|
||||
|
||||
// advance in the X direction
|
||||
curx += font->char_width(bounds.height(), aspect, *s);
|
||||
curx += font->char_width(bounds.height(), aspect, schar);
|
||||
s += scharcount;
|
||||
}
|
||||
|
||||
// free the temporary bitmap and font
|
||||
@ -1100,12 +1112,22 @@ void layout_element::component::draw_reel(running_machine &machine, bitmap_argb3
|
||||
// allocate a temporary bitmap
|
||||
bitmap_argb32 tempbitmap(dest.width(), dest.height());
|
||||
|
||||
const char *origs = m_stopnames[fruit].c_str();
|
||||
const char *ends = origs + strlen(origs);
|
||||
const char *s = origs;
|
||||
unicode_char schar;
|
||||
|
||||
// loop over characters
|
||||
for (const char *s = m_stopnames[fruit].c_str(); *s != 0; s++)
|
||||
while (*s != 0)
|
||||
{
|
||||
int scharcount = uchar_from_utf8(&schar, s, ends - s);
|
||||
|
||||
if (scharcount == -1)
|
||||
break;
|
||||
|
||||
// get the font bitmap
|
||||
rectangle chbounds;
|
||||
font->get_scaled_bitmap_and_bounds(tempbitmap, ourheight/num_shown, aspect, *s, chbounds);
|
||||
font->get_scaled_bitmap_and_bounds(tempbitmap, ourheight/num_shown, aspect, schar, chbounds);
|
||||
|
||||
// copy the data into the target
|
||||
for (int y = 0; y < chbounds.height(); y++)
|
||||
@ -1137,8 +1159,8 @@ void layout_element::component::draw_reel(running_machine &machine, bitmap_argb3
|
||||
}
|
||||
|
||||
// advance in the X direction
|
||||
curx += font->char_width(ourheight/num_shown, aspect, *s);
|
||||
|
||||
curx += font->char_width(ourheight/num_shown, aspect, schar);
|
||||
s += scharcount;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1250,12 +1272,23 @@ void layout_element::component::draw_beltreel(running_machine &machine, bitmap_a
|
||||
// allocate a temporary bitmap
|
||||
bitmap_argb32 tempbitmap(dest.width(), dest.height());
|
||||
|
||||
|
||||
const char *origs =m_stopnames[fruit].c_str();
|
||||
const char *ends = origs + strlen(origs);
|
||||
const char *s = origs;
|
||||
unicode_char schar;
|
||||
|
||||
// loop over characters
|
||||
for (const char *s = m_stopnames[fruit].c_str(); *s != 0; s++)
|
||||
while (*s != 0)
|
||||
{
|
||||
int scharcount = uchar_from_utf8(&schar, s, ends - s);
|
||||
|
||||
if (scharcount == -1)
|
||||
break;
|
||||
|
||||
// get the font bitmap
|
||||
rectangle chbounds;
|
||||
font->get_scaled_bitmap_and_bounds(tempbitmap, dest.height(), aspect, *s, chbounds);
|
||||
font->get_scaled_bitmap_and_bounds(tempbitmap, dest.height(), aspect, schar, chbounds);
|
||||
|
||||
// copy the data into the target
|
||||
for (int y = 0; y < chbounds.height(); y++)
|
||||
@ -1287,8 +1320,8 @@ void layout_element::component::draw_beltreel(running_machine &machine, bitmap_a
|
||||
}
|
||||
|
||||
// advance in the X direction
|
||||
curx += font->char_width(dest.height(), aspect, *s);
|
||||
|
||||
curx += font->char_width(dest.height(), aspect, schar);
|
||||
s += scharcount;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -975,7 +975,7 @@
|
||||
<color red="0.00" green="0.13" blue="0.00">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$1">
|
||||
<text string="£1">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
@ -1001,7 +1001,7 @@
|
||||
<color red="0.00" green="0.13" blue="0.00">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$1.60">
|
||||
<text string="£1.60">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
@ -1027,7 +1027,7 @@
|
||||
<color red="0.00" green="0.13" blue="0.00">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$2">
|
||||
<text string="£2">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
@ -1053,7 +1053,7 @@
|
||||
<color red="0.00" green="0.13" blue="0.00">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$2.40">
|
||||
<text string="£2.40">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
@ -1079,7 +1079,7 @@
|
||||
<color red="0.00" green="0.13" blue="0.00">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$3">
|
||||
<text string="£3">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
@ -1105,7 +1105,7 @@
|
||||
<color red="0.00" green="0.13" blue="0.00">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$4">
|
||||
<text string="£4">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
@ -1131,7 +1131,7 @@
|
||||
<color red="0.00" green="0.13" blue="0.00">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$5">
|
||||
<text string="£5">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
@ -1157,7 +1157,7 @@
|
||||
<color red="0.00" green="0.13" blue="0.00">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$6">
|
||||
<text string="£6">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
@ -1183,7 +1183,7 @@
|
||||
<color red="0.00" green="0.13" blue="0.00">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$8">
|
||||
<text string="£8">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
@ -2923,7 +2923,7 @@
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.45">
|
||||
</bounds>
|
||||
</text>
|
||||
<text string="$4">
|
||||
<text string="£4">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.50" width="0.90" height="0.45">
|
||||
@ -2955,7 +2955,7 @@
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.45">
|
||||
</bounds>
|
||||
</text>
|
||||
<text string="$3">
|
||||
<text string="£3">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.50" width="0.90" height="0.45">
|
||||
@ -2987,7 +2987,7 @@
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.45">
|
||||
</bounds>
|
||||
</text>
|
||||
<text string="$2">
|
||||
<text string="£2">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.50" width="0.90" height="0.45">
|
||||
@ -3019,7 +3019,7 @@
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.45">
|
||||
</bounds>
|
||||
</text>
|
||||
<text string="$1">
|
||||
<text string="£1">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.50" width="0.90" height="0.45">
|
||||
@ -3051,7 +3051,7 @@
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.45">
|
||||
</bounds>
|
||||
</text>
|
||||
<text string="$8">
|
||||
<text string="£8">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.50" width="0.90" height="0.45">
|
||||
@ -3083,7 +3083,7 @@
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.45">
|
||||
</bounds>
|
||||
</text>
|
||||
<text string="$6">
|
||||
<text string="£6">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.50" width="0.90" height="0.45">
|
||||
@ -3953,7 +3953,7 @@
|
||||
<color red="0.13" green="0.00" blue="0.06">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$1">
|
||||
<text string="£1">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
@ -3979,7 +3979,7 @@
|
||||
<color red="0.13" green="0.00" blue="0.06">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$1.20">
|
||||
<text string="£1.20">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
@ -4005,7 +4005,7 @@
|
||||
<color red="0.13" green="0.00" blue="0.06">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$1.60">
|
||||
<text string="£1.60">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
@ -4031,7 +4031,7 @@
|
||||
<color red="0.13" green="0.00" blue="0.06">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$2">
|
||||
<text string="£2">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
@ -4057,7 +4057,7 @@
|
||||
<color red="0.13" green="0.00" blue="0.06">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$2.40">
|
||||
<text string="£2.40">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
@ -4083,7 +4083,7 @@
|
||||
<color red="0.13" green="0.00" blue="0.06">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$3">
|
||||
<text string="£3">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
@ -4109,7 +4109,7 @@
|
||||
<color red="0.13" green="0.00" blue="0.06">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$3.60">
|
||||
<text string="£3.60">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
@ -4135,7 +4135,7 @@
|
||||
<color red="0.13" green="0.00" blue="0.06">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$4">
|
||||
<text string="£4">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
@ -4161,7 +4161,7 @@
|
||||
<color red="0.13" green="0.00" blue="0.06">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$8">
|
||||
<text string="£8">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
@ -4187,7 +4187,7 @@
|
||||
<color red="0.13" green="0.00" blue="0.06">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$7">
|
||||
<text string="£7">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
@ -4213,7 +4213,7 @@
|
||||
<color red="0.13" green="0.00" blue="0.06">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$6">
|
||||
<text string="£6">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
@ -4239,7 +4239,7 @@
|
||||
<color red="0.13" green="0.00" blue="0.06">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$5">
|
||||
<text string="£5">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
@ -4529,7 +4529,7 @@
|
||||
<color red="0.00" green="0.25" blue="0.00">
|
||||
</color>
|
||||
</rect>
|
||||
<text string="$1">
|
||||
<text string="£1">
|
||||
<color red="0.0" green="0.0" blue="0.0">
|
||||
</color>
|
||||
<bounds x="0.05" y="0.05" width="0.90" height="0.90">
|
||||
|
Loading…
Reference in New Issue
Block a user