【问题标题】:Firemonkey app: monospace font in TMemo?Firemonkey 应用程序:TMemo 中的等宽字体?
【发布时间】:2017-11-06 01:21:03
【问题描述】:

是否可以在 Firemonkey(使用 Delphi 10.2 Tokyo 开发)应用程序中的 TMemo 中设置/使用等宽字体。

我们试过了:

TextSettings.Font.Family := 'Courier New';  
TextSettings.Font.Family := 'Courier';  
TextSettings.Font.Family := 'Monospace';  

但是当我们在 Android 中运行应用程序时,文本字体不是等宽的。

【问题讨论】:

    标签: fonts firemonkey delphi-xe


    【解决方案1】:

    首先,不要使用 Delphi Tokyo 为 android 做任何应用程序,它还不能工作,你的应用程序会非常非常慢!你必须等待更新。

    这是android上所有可用的字体:

    // +---------------------------------------------------------------+
    // ¦    ¦ FONT FAMILY                ¦ TTF FILE                    ¦
    // ¦----+----------------------------+-----------------------------¦
    // ¦  1 ¦ casual                     ¦ ComingSoon.ttf              ¦
    // ¦  2 ¦ cursive                    ¦ DancingScript-Regular.ttf   ¦
    // ¦  3 ¦ monospace                  ¦ DroidSansMono.ttf           ¦
    // ¦  4 ¦ sans-serif                 ¦ Roboto-Regular.ttf          ¦ Roboto-Regular.ttf / Roboto-Bold.ttf / Roboto-BoldItalic.ttf / Roboto-Italic.ttf
    // ¦  5 ¦ sans-serif-black           ¦ Roboto-Black.ttf            ¦ Roboto-Black.ttf / Roboto-BlackItalic.ttf
    // ¦  6 ¦ sans-serif-condensed       ¦ RobotoCondensed-Regular.ttf ¦ RobotoCondensed-Regular.ttf / RobotoCondensed-Bold.ttf / RobotoCondensed-BoldItalic.ttf / RobotoCondensed-Italic.ttf
    // ¦  7 ¦ sans-serif-condensed-light ¦ RobotoCondensed-Light.ttf   ¦ RobotoCondensed-Light.ttf /  RobotoCondensed-LightItalic.ttf
    // ¦  8 ¦ sans-serif-light           ¦ Roboto-Light.ttf            ¦ Roboto-Light.ttf / Roboto-LightItalic.ttf
    // ¦  9 ¦ sans-serif-medium          ¦ Roboto-Medium.ttf           ¦ Roboto-Medium.ttf / Roboto-MediumItalic.ttf
    // ¦ 10 ¦ sans-serif-smallcaps       ¦ CarroisGothicSC-Regular.ttf ¦
    // ¦ 11 ¦ sans-serif-thin            ¦ Roboto-Thin.ttf             ¦ Roboto-Thin.ttf / Roboto-ThinItalic.ttf
    // ¦ 12 ¦ serif                      ¦ NotoSerif-Regular.ttf       ¦
    // ¦ 13 ¦ serif-monospace            ¦ CutiveMono.ttf              ¦
    // +---------------------------------------------------------------+
    

    所以试试 serif-monospace

    【讨论】:

    • 谢谢!但我以另一种方式解决了这个问题(见我的分析器)。你觉得 Delphi 10.2 Tokyo 比 Delphi 10.1 Berlin 慢很多吗?
    • 是的,请看这里:quality.embarcadero.com/browse/RSP-17162 ...别忘了也投票:)
    【解决方案2】:

    我是这样解决问题的:

    {$IFDEF MSWINDOWS}
        Memo1.TextSettings.Font.Family := 'Courier New';
        Memo1.StyledSettings :=  Memo1.StyledSettings - [TStyledSetting.Family]
    {$ENDIF}
    {$IFDEF ANDROID}
        Memo1.TextSettings.Font.Family := 'monospace';
        Memo1.StyledSettings :=  Memo1.StyledSettings - [TStyledSetting.Family]
    {$ENDIF}
    

    【讨论】:

      猜你喜欢
      • 2013-10-02
      • 2015-08-11
      • 2020-12-17
      • 1970-01-01
      • 2013-01-09
      • 1970-01-01
      • 2010-11-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多