#22 Add ability to support second font

wont-fix
New API (9)
5
2014-03-26
2012-09-03
Anonymous
No

Ah...It's a mistake about last Feature Request,Forgive my mouse.
OK, Let me finish it:
I'm a Chinese. After this update(v2.0.4),The default font change to Consolas(On win7), It's beautiful. But it cannot
display Chinese characters.So, Can RSTA add a ability to support second font ? Let it if the first font can not display
a character then use the second font to display it.(Or like the Microsoft Office Word, to set font to English and Chinese).
Best wished for you!
quan.liang

Discussion

  • Feature Sample

     
    Attachments
  • Robert Futrell
    Robert Futrell
    2012-09-03

    Java has the concept of "composite fonts," where it picks a fallback font to use for glyphs not in the current physical font, but you don't get it automatically when using the standard "new Font()" constructors. You do seem to get this behavior if you use StyleContext.getDefaultStyleContext().getFont().

    Please try using the jar below and see if it fixes your problem. It allows RSTA to show Korean glyphs for me out-of-the-box:

    http://fifesoft.com/temp/rsyntaxtextarea.jar

    If you can confirm this for me then I'll make an update release that includes it.

    When using custom fonts in RSTA, you can fix this problem by using StyleContext to create the fonts to use instead of the Font class directly. For example:

    //Font font = new Font("MyFontFamily", Font.PLAIN, 13);
    Font font = StyleContext.getDefaultStyleContext().getFont("MyFontFamily", Font.PLAIN, 13);
    // Use font in RSTA's SyntaxScheme or wherever else.

    Again, please confirm that this fix works for you!

     
  • Liquid Water
    Liquid Water
    2012-09-04

    Thanks for your reply!

    The ways that you provide can solve the problem of Chinese characters can not be displayed.
    Then, Is there a better way to solve this problem? As I said before,
    I want to use "Courier New" to show English and use "Microsoft Yahei" to show Chinese.
    If I create and apply a "Microsoft Yahei" font(by StyleContext), The English will be shown by it also.

    I'm a Java beginner, If Java can do this, tell me the way please, Thank you!

    Good luck to you!

     
  • Robert Futrell
    Robert Futrell
    2012-09-07

    I've gone ahead and released a minor update, 2.0.4.1, which fixes the out-of-the-box Asian language rendering. Keeping this tracker open to explore user-defined secondary languages.

     
  • Robert Futrell
    Robert Futrell
    2012-09-07

    Correction to my previous comment: instead of "to explore user-defined secondary languages," I mean "to explore user-defined secondary *fonts*".

     
  • Liquid Water
    Liquid Water
    2012-09-10

    I have downloaded the latest update and I will continue to focus on this. Thank you!

    Good luck to you!

     
  • Robert Futrell
    Robert Futrell
    2014-03-26

    Closing this since I don't think it will ever be added.

     
  • Robert Futrell
    Robert Futrell
    2014-03-26

    • status: open --> wont-fix
    • Group: --> Next Release (example)