Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/source/techspecs/layout_files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,10 @@ text
Draws text in using the UI font in the specified colour. The text to draw
must be supplied using a ``string`` attribute. An ``align`` attribute may
be supplied to set text alignment. If present, the ``align`` attribute must
be an integer, where 0 (zero) means centred, 1 (one) means left-aligned, and
2 (two) means right-aligned. If the ``align`` attribute is absent, the text
will be centred.
be an integer, where 0 (zero) means centred, 1 (one) means left-aligned,
2 (two) means right-aligned, and 3 (three) means that the text will be
stretched horizontally to fill its bounds. If the ``align`` attribute is
absent, the text will be centred.
led7seg
Draws a standard seven-segment (plus decimal point) digital LED/fluorescent
display in the specified colour. The low eight bits of the element’s state
Expand Down
2 changes: 1 addition & 1 deletion scripts/build/complay.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def elementStartHandler(self, name, attrs):
if 'string' not in attrs:
self.handle_error('Element text missing attribute string')
align = self.check_int_attribute(name, attrs, 'align', None)
if (align is not None) and ((0 > align) or (2 < align)):
if (align is not None) and ((0 > align) or (3 < align)):
self.handle_error('Element text attribute align "%s" not in valid range 0-2' % (attrs['align'], ))
self.check_component(name, attrs)
elif 'simplecounter' == name:
Expand Down
40 changes: 11 additions & 29 deletions src/emu/rendlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3219,16 +3219,8 @@ class layout_element::reel_component : public component
bitmap_argb32 tempbitmap(dest.width(), dest.height());

// get the width of the string
float aspect = 1.0f;
s32 width;

while (1)
{
width = font->string_width(ourheight / num_shown, aspect, m_stopnames[fruit]);
if (width < bounds.width())
break;
aspect *= 0.95f;
}
s32 width = font->string_width(ourheight / num_shown, 1.0f, m_stopnames[fruit]);
float aspect = width > bounds.width() ? (float) bounds.width() / (float) width : 1.0f;

float curx = bounds.left() + (bounds.width() - width) / 2.0f;

Expand Down Expand Up @@ -3368,15 +3360,8 @@ class layout_element::reel_component : public component
else // render text (fallback)
{
// get the width of the string
float aspect = 1.0f;
s32 width;
while (1)
{
width = font->string_width(dest.height(), aspect, m_stopnames[fruit]);
if (width < bounds.width())
break;
aspect *= 0.95f;
}
s32 width = font->string_width(dest.height(), 1.0f, m_stopnames[fruit]);
float aspect = width > bounds.width() ? (float) bounds.width() / (float) width : 1.0f;

float curx = bounds.left();

Expand Down Expand Up @@ -3716,16 +3701,8 @@ void layout_element::component::draw_text(
const render_color &color)
{
// get the width of the string
float aspect = 1.0f;
s32 width;

while (1)
{
width = font.string_width(bounds.height(), aspect, str);
if (width < bounds.width())
break;
aspect *= 0.95f;
}
s32 width = font.string_width(bounds.height(), 1.0f, str);
float aspect = (align == 3 || width > bounds.width()) ? (float) bounds.width() / (float) width : 1.0f;

// get alignment
float curx;
Expand All @@ -3740,6 +3717,11 @@ void layout_element::component::draw_text(
case 2:
curx = bounds.right() - width;
break;

// stretch
case 3:
curx = bounds.left();
break;

// default to center
default:
Expand Down
26 changes: 12 additions & 14 deletions src/mame/layout/sd1.lay
Original file line number Diff line number Diff line change
Expand Up @@ -468,23 +468,21 @@
<element name="text_L_phones">
<text string="Phones" align="1" />
</element>
<element name="text_L_music_production_synthesizer">
<text string="MUSIC PRODUCTION SYNTHESIZER" align="1" />
<element name="text_S_music_production_synthesizer">
<text string="MUSIC PRODUCTION SYNTHESIZER" align="3" />
</element>
<element name="text_ensoniq">
<text string="ensoniq" />
<element name="text_S_ensoniq">
<text string="ensoniq" align="3" />
</element>
<element name="text_L_sd_1">
<text string="SD-1" align="1" />
<element name="text_S_sd_1">
<text string="SD-1" align="3" />
</element>
<element name="text_L_patch_select">
<text string="Patch Select" align="1" />
</element>

<element name="plugin_warning" defstate="1">
<rect state="1">
<color red="0.69804" green="0.69804" blue="0.69804" />
</rect>
<rect name="Color(name='plugin_warning_background', _hex='#b2b2b2', _rgb=[0.6980392156862745, 0.6980392156862745, 0.6980392156862745])" state="1" />
<text string="This view requires the layout plugin." align="0" state="1">
<color red="0.73333" green="0.17255" blue="0.17255" />
</text>
Expand Down Expand Up @@ -2523,13 +2521,13 @@
<element ref="text_L_cartridge">
<bounds x="720" y="17.7" width="56" height="4.3" />
</element>
<element ref="text_L_music_production_synthesizer">
<bounds x="13" y="7" width="200" height="4.3" />
<element ref="text_S_music_production_synthesizer">
<bounds x="13" y="7" width="88" height="4.3" />
</element>
<element ref="text_ensoniq">
<bounds x="765" y="92" width="62" height="9" />
<element ref="text_S_ensoniq">
<bounds x="762" y="92" width="68" height="9" />
</element>
<element ref="text_L_sd_1">
<element ref="text_S_sd_1">
<bounds x="13" y="77.5" width="67" height="27" />
</element>
<element name="lights" ref="light_16">
Expand Down
32 changes: 15 additions & 17 deletions src/mame/layout/sd132.lay
Original file line number Diff line number Diff line change
Expand Up @@ -468,26 +468,24 @@
<element name="text_L_phones">
<text string="Phones" align="1" />
</element>
<element name="text_L_music_production_synthesizer">
<text string="MUSIC PRODUCTION SYNTHESIZER" align="1" />
<element name="text_S_music_production_synthesizer">
<text string="MUSIC PRODUCTION SYNTHESIZER" align="3" />
</element>
<element name="text_ensoniq">
<text string="ensoniq" />
<element name="text_S_ensoniq">
<text string="ensoniq" align="3" />
</element>
<element name="text_3__2__v__o__i__c__e">
<text string="3 2 V O I C E" />
<element name="text_S_3__2__v__o__i__c__e">
<text string="3 2 V O I C E" align="3" />
</element>
<element name="text_L_sd_1">
<text string="SD-1" align="1" />
<element name="text_S_sd_1">
<text string="SD-1" align="3" />
</element>
<element name="text_L_patch_select">
<text string="Patch Select" align="1" />
</element>

<element name="plugin_warning" defstate="1">
<rect state="1">
<color red="0.69804" green="0.69804" blue="0.69804" />
</rect>
<rect name="Color(name='plugin_warning_background', _hex='#b2b2b2', _rgb=[0.6980392156862745, 0.6980392156862745, 0.6980392156862745])" state="1" />
<text string="This view requires the layout plugin." align="0" state="1">
<color red="0.73333" green="0.17255" blue="0.17255" />
</text>
Expand Down Expand Up @@ -2529,17 +2527,17 @@
<element ref="text_L_cartridge">
<bounds x="720" y="17.7" width="56" height="4.3" />
</element>
<element ref="text_L_music_production_synthesizer">
<bounds x="13" y="7" width="200" height="4.3" />
<element ref="text_S_music_production_synthesizer">
<bounds x="13" y="7" width="88" height="4.3" />
</element>
<element ref="text_ensoniq">
<bounds x="765" y="92" width="62" height="9" />
<element ref="text_S_ensoniq">
<bounds x="762" y="92" width="68" height="9" />
</element>
<element ref="text_3__2__v__o__i__c__e">
<element ref="text_S_3__2__v__o__i__c__e">
<bounds x="14" y="98.5" width="65" height="5" />
<color red="0.2" green="0.2" blue="0.2" />
</element>
<element ref="text_L_sd_1">
<element ref="text_S_sd_1">
<bounds x="13" y="67.5" width="67" height="27" />
</element>
<element name="lights" ref="light_16">
Expand Down
26 changes: 12 additions & 14 deletions src/mame/layout/vfx.lay
Original file line number Diff line number Diff line change
Expand Up @@ -412,23 +412,21 @@
<element name="text_L_phones">
<text string="Phones" align="1" />
</element>
<element name="text_L_dynamic_component_synthesizer">
<text string="DYNAMIC COMPONENT SYNTHESIZER" align="1" />
<element name="text_S_dynamic_component_synthesizer">
<text string="DYNAMIC COMPONENT SYNTHESIZER" align="3" />
</element>
<element name="text_ensoniq">
<text string="ensoniq" />
<element name="text_S_ensoniq">
<text string="ensoniq" align="3" />
</element>
<element name="text_L_vfx">
<text string="VFX" align="1" />
<element name="text_S_vfx">
<text string="VFX" align="3" />
</element>
<element name="text_L_patch_select">
<text string="Patch Select" align="1" />
</element>

<element name="plugin_warning" defstate="1">
<rect state="1">
<color red="0.69804" green="0.69804" blue="0.69804" />
</rect>
<rect name="Color(name='plugin_warning_background', _hex='#b2b2b2', _rgb=[0.6980392156862745, 0.6980392156862745, 0.6980392156862745])" state="1" />
<text string="This view requires the layout plugin." align="0" state="1">
<color red="0.73333" green="0.17255" blue="0.17255" />
</text>
Expand Down Expand Up @@ -2344,13 +2342,13 @@
<element ref="text_L_cartridge">
<bounds x="720" y="17.7" width="56" height="4.3" />
</element>
<element ref="text_L_dynamic_component_synthesizer">
<bounds x="13" y="7" width="200" height="4.3" />
<element ref="text_S_dynamic_component_synthesizer">
<bounds x="13" y="7" width="88" height="4.3" />
</element>
<element ref="text_ensoniq">
<bounds x="765" y="92" width="62" height="9" />
<element ref="text_S_ensoniq">
<bounds x="762" y="92" width="68" height="9" />
</element>
<element ref="text_L_vfx">
<element ref="text_S_vfx">
<bounds x="13" y="70.5" width="92" height="43" />
</element>
<group ref="Sliders">
Expand Down
26 changes: 12 additions & 14 deletions src/mame/layout/vfxsd.lay
Original file line number Diff line number Diff line change
Expand Up @@ -468,23 +468,21 @@
<element name="text_L_phones">
<text string="Phones" align="1" />
</element>
<element name="text_L_music_production_synthesizer">
<text string="MUSIC PRODUCTION SYNTHESIZER" align="1" />
<element name="text_S_music_production_synthesizer">
<text string="MUSIC PRODUCTION SYNTHESIZER" align="3" />
</element>
<element name="text_ensoniq">
<text string="ensoniq" />
<element name="text_S_ensoniq">
<text string="ensoniq" align="3" />
</element>
<element name="text_L_vfx_sd">
<text string="VFX-SD" align="1" />
<element name="text_S_vfx_sd">
<text string="VFX-SD" align="3" />
</element>
<element name="text_L_patch_select">
<text string="Patch Select" align="1" />
</element>

<element name="plugin_warning" defstate="1">
<rect state="1">
<color red="0.69804" green="0.69804" blue="0.69804" />
</rect>
<rect name="Color(name='plugin_warning_background', _hex='#b2b2b2', _rgb=[0.6980392156862745, 0.6980392156862745, 0.6980392156862745])" state="1" />
<text string="This view requires the layout plugin." align="0" state="1">
<color red="0.73333" green="0.17255" blue="0.17255" />
</text>
Expand Down Expand Up @@ -2523,13 +2521,13 @@
<element ref="text_L_cartridge">
<bounds x="720" y="17.7" width="56" height="4.3" />
</element>
<element ref="text_L_music_production_synthesizer">
<bounds x="13" y="7" width="200" height="4.3" />
<element ref="text_S_music_production_synthesizer">
<bounds x="13" y="7" width="88" height="4.3" />
</element>
<element ref="text_ensoniq">
<bounds x="765" y="92" width="62" height="9" />
<element ref="text_S_ensoniq">
<bounds x="762" y="92" width="68" height="9" />
</element>
<element ref="text_L_vfx_sd">
<element ref="text_S_vfx_sd">
<bounds x="13" y="77.5" width="67" height="27" />
</element>
<element name="lights" ref="light_16">
Expand Down
Loading