首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >获得希伯来文的字体轮廓

获得希伯来文的字体轮廓
EN

Stack Overflow用户
提问于 2015-09-04 10:32:08
回答 1查看 155关注 0票数 1

我已经编辑了一段代码,可以获取文本的所有轮廓数据,这样我就可以在其他程序中手动将其绘制为线条。我的代码在英语中效果很好,但是当我试图发送希伯来语文本时,轮廓会变成乱七八糟的字体。

代码的主要步骤是:字体-> GlyphTypeface -> GlyphRun

主要代码是

代码语言:javascript
复制
Private m_gtf As System.Windows.Media.GlyphTypeface
Private m_glypText As GlyphRun
Private m_textFont As System.Drawing.Font

textFont = New Font("Aharoni", 12, FontStyle.Regular, GraphicsUnit.World, 177, False)
m_typeface = New Typeface(New System.Windows.Media.FontFamily(m_textFont.Name), m_fontStyle, _
m_fontWeight, New System.Windows.FontStretch())
m_typeface.TryGetGlyphTypeface(m_gtf)

'then use m_gtf to crate the m_glyphIndices and advanceWidths vectors 

m_glypText = New GlyphRun(m_gtf, bidiLevel, False, m_height, m_glyphIndices, origin, advanceWidths, _ 
Nothing, Nothing, Nothing, Nothing, Nothing, Nothing)

我认为我的问题是"m_typeface =新字体(…)“在此命令中,无法发送字体gdiCharSet值。

有没有办法直接从m_textFont中得到字体?或者还有其他方法可以做到这一点?

佐哈尔

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-09-06 07:23:06

发现问题了。

我用的是:

代码语言:javascript
复制
Dim glyphIndex As UShort = m_gtf.CharacterToGlyphMap(Asc(m_textString(n)))

但是我必须使用AscW来获得正确的ascii代码:

代码语言:javascript
复制
Dim glyphIndex As UShort = m_gtf.CharacterToGlyphMap(AscW(m_textString(n)))

现在起作用了!佐哈尔

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32395895

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档