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.
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
Tahoma, 72 pts (disable TrueType Hinting)
Tahoma, 8 pts, (disable TrueType Hinting)
Tahoma, 11 pts (disable TrueType Hinting)
Enable Kerning
SubPixel Rendering
Multi-channel signed distance field (Msdf) Texture (https://github.com/Chlumsky/msdfgen)
Msdf Texture
Android GLES2-based
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.
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
pic 1: show GSUB's glyph ligature, see f-i
(see more : LayoutFarm#80 (comment))
2. GPOS
pic 2: test with Thai (complex script) glyph that require gpos table
3. GSUB : ccmp
pic 3: test with Thai glyph (complex script) , shows glyph substitution
4. GSUB - GPOS
pic 4: test with Thai glyph (complex script)
(see more: LayoutFarm#82 (comment))
Fun with Emoji !
The Emoji and related features are contributed by @samhocevar
pic 1: Segoe UI Symbol Normal, on Win7
pic 2: FireFoxEmoji.ttf from https://github.com/mozilla/fxemoji
pic 3: Segoe UI Emoji Normal, Win 10
Advanced Emoji Ligature
This is 👩🏾👨🏾👧🏾👶🏾 “Family - Woman: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone” without
ccmp
ligatures:
And here it is with
ccmp
:
pic 4: Say with Emoji?
(see: LayoutFarm#18)
(see more sam's work at https://github.com/samhocevar/emoji.wpf)
The HtmlRenderer example!
This is a snapshot of Html drawboard from (https://github.com/LayoutFarm/HtmlRenderer). The glyphs are generated/layouted with our Typography, and rendered with the PixelFarm (https://github.com/PaintLab/PixelFarm)
pic 1: HtmlRenderer on GLES2 surface, text are renderered with the Typography
also, please note the text selection on the Html Surface.
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