显示亚洲字符(使用Unicode):与使用ExtTextOut相比,在RichEdit控件中显示时,字符间距有所不同 [英] Display of Asian characters (with Unicode): Difference in character spacing when presented in a RichEdit control compared with using ExtTextOut

查看:189
本文介绍了显示亚洲字符(使用Unicode):与使用ExtTextOut相比,在RichEdit控件中显示时,字符间距有所不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这张照片说明了我的困境:

This picture illustrates my predicament:

所有字符看起来都一样大小,但是与使用ExtTextOut时相比,在RichEdit控件中显示时它们之间的间距是不同的.

All of the characters appear to be the same size, but the space between them is different when presented in a RichEdit control compared with when I use ExtTextOut.

为了保持换行位置,我想呈现与RichEdit控件中相同的字符.

I would like to present the characters the same as in the RichEdit control (ideally), in order to preserve wrap positions.

谁能告诉我:

a)哪个代表更正确?

b)为什么RichEdit控件显示的文本在亚洲字符之间没有空格?

c)有什么方法可以使ExtTextOut在绘制这些字符时重现RichEdit控件的行为?

d)如果我正在使用亚洲版本的Windows,这会有所不同吗?

也许我很乐观,但是如果有人能提供任何提示,我会很感兴趣的.

Perhaps I'm being optimistic, but if anyone has any hints to offer, I'd be very interested to hear.

以防万一:

这是我的文字:

快的棕色狐狸跳在懶惰狗1 2 3 4 5 6 7 8 9 0

对亚洲读者的道歉,这只是为了测试我们的Unicode实现,我什至不知道字符取自哪种语言,更不用说它们是否意味着什么了

为了通过将这些字符粘贴到RichEdit控件(例如,写字板)中来查看效果,您可能会发现必须滑动它们并将字体设置为"Arial".

In order to view the effect by pasting these characters into a RichEdit control (eg. Wordpad), you may find you have to swipe them and set the font to 'Arial'.

我获得的富文本格式是:

The rich text that I obtain is:


{\rtf1\ansi\ansicpg1252\deff0\deflang2057{\fonttbl{\f0\fnil\fcharset0 Arial;}}{\colortbl ;\red0\green0\blue0;}\viewkind4\uc1\pard\sa200\sl276\slmult1\lang9\fs22\u24555?\u30340?\u26837?\u33394?\u29392?\u29432?\u36339?\u22312?\u25078?\u24816?\u29399?1 2 3 4 5 6 7 8 9 0\par\pard\'a3 $$ \'80\'80\cf1\lang2057\fs16\par}

它似乎没有包含字符"pitch"的值,这是我的第一个念头.

It doesn't appear to contain a value for character 'pitch' which was my first thought.

推荐答案

我不知道答案,但有几件事情值得怀疑:

I don't know the answer, but there are several things to suspect:

  • 丰富的编辑控件有多种版本.也许您使用的是旧版,但没有所有最新的版式改进.
  • 有许多样式和标志会影响丰富的editcontrol的行为,因此您可能想研究设置了哪些样式和它们做了什么.例如,查看 EM_GETEDITSTYLE .
  • 许多亚洲字体在Windows上有两个版本.一种针对水平布局进行了优化,另一种针对垂直布局进行了优化.后者通常具有相同的名称,但在其前面加上@.也许您在Rich Edit控件中使用的是错误的.
  • There are several versions of the rich edit control. Perhaps you're using an older one that doesn't have all the latest typographic improvements.
  • There are many styles and flags that affect the behavior of a rich editcontrol, so you might want to explore which ones are set and what they do. For example, look at EM_GETEDITSTYLE.
  • Many Asian fonts come in two versions on Windows. One is optimized for horizontal layout, and the other for vertical layout. That latter usually has the same name, but has @ prepended to it. Perhaps you are using the wrong one in the rich edit control.

更新:通过弄乱写字板,我能够在丰富的编辑控件中重现文本拥挤的问题.

UPDATE: By messing around with Wordpad, I was able to reproduce the problem with the crowded text in the rich edit control.

  1. 在Windows 7的Wordpad中打开一个新文档.请注意,所选字体为Calibri.
  2. 将示例文本粘贴到文档中.
  3. 文本显示正确,但是Wordpad将字体更改为SimSun.
  4. 选择文本并将字体更改回Calibri或Arial.

现在,文本将变得人满为患,与您的示例非常相似.因此,看来根本的问题在于字体链接和回退. ExtTextOut可能正在为脚本自动选择适当的字体.您面临的挑战是弄清楚如何为脚本识别正确的字体并在丰富的编辑控件中设置该字体.

The text will now be overcrowded, very similar to your example. Thus it appears the fundamental problem is with font linking and fallback. ExtTextOut is probably selecting an appropriate font for the script automatically. Your challenge is to figure out how to identify the right font for the script and set that font in the rich edit control.

这篇关于显示亚洲字符(使用Unicode):与使用ExtTextOut相比,在RichEdit控件中显示时,字符间距有所不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆