Typography

C# Font Reader (TrueType / OpenType) , Glyphs Layout and Rendering

1 year after

Typography, this img was rendered with this lib, in subpixel rendering mode

Pure C# TrueType/OpenType/OpenFont Reader, Glyph Layout and Rendering.

During developing the PixelFarm, I think 'How-to-render-a-font-glyph' may be useful for other libs.

So, I spin off 'How-to-render-a-font-glyph' part to here,the Typography.

The Typography lib dose NOT NEED PixelFarm Rendering lib.

gdiplus_sample1

pic 1: Typography project's Solution Explorer View

see pic1, I provide the example(1) that uses Typography with WinGdiPlus,

and the example(2) the uses Typography with 'mini' snapshot of PixelFarm Rendering Lib(3).

Concept

  • 1.Loads .ttf files, with OpenFontReader.

  • 2.Rasterizes char to bitmap with pure software renderer + Agg(anti grain geometry) Quality! with our PixelFarm's MiniAgg :) (https://github.com/PaintLab/PixelFarm)

  • .Net >=2.0

Screenshots

Some screenshots of the current master.

Screenshot


Enable TrueType Hinting, Tahoma , 8 pts

enable_truetype_hinting


Tahoma, 72 pts (disable TrueType Hinting)

compare1_tahoma_72pts


Tahoma, 8 pts, (disable TrueType Hinting)

compare2_tahoma_8pts


Tahoma, 11 pts (disable TrueType Hinting)

compare3_tahoma_11pts


Enable Kerning

enable_kerning1


SubPixel Rendering

lcd_09


Multi-channel signed distance field (Msdf) Texture (https://github.com/Chlumsky/msdfgen)

msdfgen


Msdf Texture

msdfgen2


Android GLES2-based

gles_android_emu

pic 1: GLES2-based android demo, DroidSans.ttf. Each glyph is tesselated to GlyphRun mesh (with C# Tesselator), and is rendered directly to GLES2 shader.

gles_android_emu

pic 2: same technique as pic1, msjh.ttf, '啊rAbc' ,

please note that baseline of 啊 is not correct


Advance OpenFont Text Shaping

1. GSUB : ligature feature

ligature

pic 1: show GSUB's glyph ligature, see f-i


2. GPOS

gpos

pic 2: test with Thai (complex script) glyph that require gpos table


3. GSUB : ccmp

gsub

pic 3: test with Thai glyph (complex script) , shows glyph substitution


4. GSUB - GPOS

th_glyph

th_glyph2

pic 4: test with Thai glyph (complex script)


License

Source code from multiple projects. I select ONLY PERMISSIVE license. Here...

Font

Apache2, 2014-2016, Samuel Carlsson, Big thanks for https://github.com/vidstige/NRasterizer

MIT, 2015, Michael Popoloski MIT, from https://github.com/MikePopoloski/SharpFont

The FreeType Project LICENSE (3-clauses BSD style),2003-2016, David Turner, Robert Wilhelm, and Werner Lemberg and others, from https://www.freetype.org/

MIT, 2016, Viktor Chlumsky, from https://github.com/Chlumsky/msdfgen

Geometry

BSD, 2009-2010, Poly2Tri Contributors, from https://github.com/PaintLab/poly2tri-cs

BSD, 2002-2005, Maxim Shemanarev, Anti-Grain Geometry - Version 2.4 from http://www.antigrain.com

BSD, 2007-2014, Lars Brubaker, agg-sharp, from https://github.com/MatterHackers/agg-sharp

MIT, 2016, Viktor Chlumsky, from https://github.com/Chlumsky/msdfgen

Apache2, 2016-2017, WinterDev, from https://github.com/PaintLab/PixelFarm

Platforms

MIT, 2015-2015, Xamarin, Inc., from https://github.com/mono/SkiaSharp

MIT, 2006-2009, Stefanos Apostolopoulos and other Open Tool Kit Contributors, from https://github.com/opentk/opentk

MIT, 2013, Antonie Blom, from https://github.com/andykorth/Pencil.Gaming

MIT, 2004,2007, Novell Inc., for System.Drawing

Demo

MIT, 2017, Zou Wei, https://github.com/zwcloud

Related Repositories

typography.js

typography.js

A powerful toolkit for building websites with beautiful design ...

simple-typography

simple-typography

A simple starting ground for beautiful typography on the web using Sass. ...

customizer-typography

customizer-typography

Proof-of-concept for a typography class and multiple settings tied to a customiz ...

awesome-typography

awesome-typography

✏︎ Curated list about typography ...

LESS-Typography-Boilerplate

LESS-Typography-Boilerplate

A starter kit to good web typography with an easy baseline grid. ...