Skip to main content
Inspiring
November 13, 2023
Question

(AS3) Different fonts for each language in the text field

  • November 13, 2023
  • 1 reply
  • 409 views

I have a textfield with about 100000 characters.
Is there a way to display different fonts for each language in this field?
(For example) English=>"Arial", Hangul=>"Malkun Gothic"
If possible, please provide sample code.

    This topic has been closed for replies.

    1 reply

    JoãoCésar17023019
    Community Expert
    Community Expert
    November 13, 2023

    Hi.

     

    You can create a new TextFormat instance, change the font property and apply this TextFormat instance to the target text field using the defaultTextFormat property.

     

    Regards,

    JC

    Inspiring
    November 14, 2023

    I think my question is wrong.
    The text field contains a mixture of English and Korean.
    In this case I am asking how to apply different fonts for each language.

    kglad
    Community Expert
    Community Expert
    November 14, 2023

    If that's the case, you need to use the htmlText property. Among other things, it makes possible to use more than one font face in the same text field.

     

    Example:

     

    yourTextField.htmlText = '<p><font face="Times New Roman">Lorem ipsum</font></p>\n<font face="Arial">Lorem ipsum</font></p>';

     

     

    https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.html#htmlText

     

    Regards,

    JC


    you can use as3 and non-html text via the setTextFormat method