C# lib for processing font files - TTF (TrueType), others [closed]

可紊 提交于 2019-12-29 04:22:06

问题


Any known C# library or project out there that can understand the TTF file format? Most questions Ive seen regarding this are attempting to do custom rendering, but I'm more interested in a font editor type of application.


回答1:


Don't know what you want to do exactly, but WPF has a cool GlyphTypeface Class that is quite abstract and quite independent.

This is how you can start with:

GlyphTypeface ttf = new GlyphTypeface(new Uri(@"c:\windows\fonts\verdana.ttf"));

There are also the GlyphRun Class and the GlyphRunDrawing Class.

Otherwise, if you're looking for the big picture, open-source, you can also check the FreeType Project, available here: http://freetype.org/




回答2:


I want to introduce another pure C# lib for processing font. Here https://github.com/LayoutFarm/Typography

Pure C#

support .NET >=20

access general glyph data,

and access advanced typography data.

(such as GDEF,GSUB,GPOS) etc.


The below image shows some screen snapshot,

compare then lib's rendering glyph 'B'

  1. (left) : glyph from the lib without Hinting

  2. (middle) : Windows's GDI with clear type (from notepad)

  3. (right): glyph from the lib with True Hinting


snap 2: I'm developing auto-hint, and grid fitting.

test it out, and feel free to comment, fork, discuss.


snap 3: subpixel rendering




回答3:


There is a .net wrapper for FreeType available here: https://github.com/Robmaister/SharpFont

It's also available on nuget:

PM> Install-Package SharpFont


来源:https://stackoverflow.com/questions/4628247/c-sharp-lib-for-processing-font-files-ttf-truetype-others

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!