Skip to content

unicorn-tank/Typography

 
 

Repository files navigation

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.

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


Msdf Texture Sample msdf_test_03


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)


Fun with Emoji !

The Emoji and related features are contributed by @samhocevar

typo_symbol

pic 1: Segoe UI Symbol Normal, on Win7

typo_symbol2

pic 2: FireFoxEmoji.ttf from https://github.com/mozilla/fxemoji

typo_symbol3

pic 3: Segoe UI Emoji Normal, Win 10


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, https://github.com/MikePopoloski/SharpFont

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

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

Geometry

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

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

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

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

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

Platforms

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

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

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

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

Demo

MIT, 2017, Zou Wei, https://github.com/zwcloud, see more Zou Wei's GUI works at here and here

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%