Lazarus中文社区

 找回密码
 立即注册(注册审核可向QQ群索取)

QQ登录

只需一步,快速开始

版权申明
查看: 2113|回复: 2

分享一个字体,解决单个标点字符串右引号显示问题

[复制链接]
  • TA的每日心情
    开心
    2020-9-18 14:51
  • 签到天数: 47 天

    [LV.5]常住居民I

    发表于 2013-12-23 10:07:05 | 显示全部楼层 |阅读模式
    本帖最后由 lhxzui 于 2014-3-13 23:09 编辑

    IDE默认安装字体Courier New,发现在显示单个中文标点字符串,如'、',会出现右侧单引号显示异常问题。
    在forum.lazarus.freepascal.org发帖描述了这个问题,http://forum.lazarus.freepascal.org/index.php/topic,22558.60.html

    Martin_fr 回复中建议:
    Chinese dot may be a " full width" char. Please check which font you use (tools > options)
    Maybe try other fonts. MUST be monospaced. (courier / deja vu mono)
    尝试了courier,无此问题,但觉得这个字体不好看。
    于是找到了Deja Vu Sans Mono,试了一下,没有上述问题。
    另外推荐Deja Vu Sans Mono的原因:
    大写I和l,数字1和小写l,数字0,大小写字母o,还有标点,可辨识度很好,是等宽的。
    用着好的或不好的,请回来说一下,谢谢。

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册(注册审核可向QQ群索取)

    x

    评分

    参与人数 1金钱 +10 贡献值 +1 收起 理由
    bugxiong + 10 + 1 Lazarus有你更精彩

    查看全部评分

    回复

    使用道具 举报

  • TA的每日心情
    开心
    2020-9-18 14:51
  • 签到天数: 47 天

    [LV.5]常住居民I

     楼主| 发表于 2013-12-28 23:39:43 | 显示全部楼层
    本帖最后由 lhxzui 于 2013-12-28 23:51 编辑

    关于这个问题,Martin_fr给出的新的回复,说实话,我看着真是费劲,因为刚接触Lazarus不久,再加上英语不给力。想深究的大神可以通过下面的连接,到该页最下部看原文。
    而我这里自从用了Deja Vu Sans Mono,A-OK.
    http://forum.lazarus.freepascal.org/index.php/topic,22558.60.html
    这里引用一份过来:
    [quote author=Martin_fr link=topic=22558.msg137146#msg137146 date=1388236890]
    @lhxzui

    There is indeed an issue with this (and a few other) char(s).

    Background: The editor does only deal with monospaced fonts. In a monospaced font there are chars of only 2 widths (full (some east Asian and others) and half (Latin)).
    http://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms
    http://www.unicode.org/reports/tr11/

    The width of each char can (or should) be predicted from a table http://www.unicode.org/Public/UCD/latest/ucd/EastAsianWidth.txt
    (actually a few a ambiguous)
    Your comma is utf8 e3 80 81 or in the table 3001 (marked "W")

    It appears that this table is currently not fully implemented.

    If the char width that the editor believes, differs from he actual font, then you get missing chars, and chars that jump, when the caret moves.

    But it is not that simple to fix. The error does not happen on my PC. It appears that European versions of windows treat those chars as half width.

    This means adding the missing entries will only shift the problem: It will (probably) work for you, but then fail for others, that get correct results now.

    ------------------------------
    This will not be possible to fix for 1.2
    And due to the above problem with different window versions, it is unclear how and when it will be fixed.

    There are various ways you can try to workaround the problem.
    You need only 1 of them. I expect 2 should be best.

    1) In the options / Editor / Display: Change the "Extra char spacing" to 1 or -1
    This does however look ugly

    2) Compile (on windows only) your IDE with  WithSynExperimentalCharWidth defined.
    Add to defines in "Configure build lazarus" or add command line option -pWithSynExperimentalCharWidth

    3) add e3 80 81  to the list in SynEditTextDoubleWidthChars
    But there are more chars....

    4) unit SynTextDrawer
    line 673 in  procedure CalcFontAdvance
    1.   // take several samples
    2.   ETO := False;
    复制代码
    change the value to "True"
    again this may not always look nice. (but better than (1))

    -----------------------------
    This should be reported on mantis
    [/quote]
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2020-9-18 14:51
  • 签到天数: 47 天

    [LV.5]常住居民I

     楼主| 发表于 2014-3-13 23:23:17 | 显示全部楼层
    教训:想尝试dejavu-fonts官网的最新版,当前官网最新版本2.34,试了发现本帖描述的问题复现,气死我了,再换回来吧。
    看来再没出问题的情况下,不要轻易尝鲜。虽然官网说升级解决了某某bug,但我没遇到异常,暂且不管它了,呵呵。
    回复 支持 反对

    使用道具 举报

    *滑块验证:

    本版积分规则

    QQ|手机版|小黑屋|Lazarus中国|Lazarus中文社区 ( 鄂ICP备16006501号-1 )

    GMT+8, 2025-5-2 23:02 , Processed in 0.026724 second(s), 10 queries , Redis On.

    Powered by Discuz! X3.4

    Copyright © 2001-2021, Tencent Cloud.

    快速回复 返回顶部 返回列表