2024-02-06 07:33 AM - last edited on 2024-09-24 10:22 AM by Doreena Deng
Hi All,
I am having an issue where I have created a font type parameter in an object subtype, however the font type doesn't want to work in the child object.
See script below:
Parameter in subtype = fta_font_type (string)
2D script
define style "fontStyle1" fta_font_type, fta_font_size, 5, fta_iFont_effects !LABEL FONT STYLE
style "fontStyle1"
Interface Script
ui_infield{2} 'fta_font_type', _uiXRight, _uiY, _columnWidth, _fillHeight ui_tooltip "Font Type"
_uiY = _uiY + (_fillHeight + _buttonGap1)
Cannot for the life of me workout why it's not working, any assistance would be greatly appreciated.
Regards,
Jarrod
Solved! Go to Solution.
2024-02-06 08:07 AM - edited 2024-02-06 08:08 AM
That won't give you a list of available fonts.
You will have to type the font name exactly in that field.
You can either create your own VALUES list for the 'fta_font_type' variable, where you can list specific font names.
Or this (in the parameter script) will search your operating system and give you a list of all of the installed fonts.
DIM fontNames[]
n = REQUEST("FONTNAMES_LIST", "", fontNames)
VALUES "fta_font_type" fontNames, CUSTOM
Barry.
2024-02-06 08:16 AM
Hi Jarrod
We can change the variable name that represents your text style with the parameter shown on the picture (default by the Label subtype).
2024-02-06 08:33 AM
Good catch.
I forgot about these fixed name optional parameters.
It seems you can use AC_TextFont_1 up to AC_TextFont_8, should you need different fonts for different reasons all in the one object.
Barry.
2024-02-06 08:07 AM - edited 2024-02-06 08:08 AM
That won't give you a list of available fonts.
You will have to type the font name exactly in that field.
You can either create your own VALUES list for the 'fta_font_type' variable, where you can list specific font names.
Or this (in the parameter script) will search your operating system and give you a list of all of the installed fonts.
DIM fontNames[]
n = REQUEST("FONTNAMES_LIST", "", fontNames)
VALUES "fta_font_type" fontNames, CUSTOM
Barry.
2024-02-06 08:16 AM
Hi Jarrod
We can change the variable name that represents your text style with the parameter shown on the picture (default by the Label subtype).
2024-02-06 08:33 AM
Good catch.
I forgot about these fixed name optional parameters.
It seems you can use AC_TextFont_1 up to AC_TextFont_8, should you need different fonts for different reasons all in the one object.
Barry.
2024-02-06 11:06 PM
All excellent solutions, thank you!
2024-02-27 11:01 AM
Hi,
Showing the font list can be done without parameter script: https://gdl.graphisoft.com/tips-and-tricks/font-names-list-handling-in-ui-script
The parameters which have a font list come from libparts under subtype "Library Master". These are executed when the library is loaded, and their parameters' value ranges are inherited by all other library parts. https://gdl.graphisoft.com/gdl-basics/parameter-logic