During developing the PixelFarm Rendering library, I think 'How-to-render-a-font-glyph' may be useful for other libraries.
So, I spinned off the 'How-to-render-a-font-glyph' part to here, the Typography library.
The Typography lib does NOT need the PixelFarm Rendering library.
Typography project's Solution Explorer View
As shown in the above screenshot, an example (marked with (1)
) that uses Typography with WinGdiPlus is provided,
and an example (marked with (2)
) the uses Typography with a 'mini' snapshot of PixelFarm Rendering library (marked with (3)
).
-
1.Load .ttf, .otf, .ttc, .otc, .woff, .woff2 files, with OpenFontReader.
-
2.Rasterize a character to a bitmap with a pure software renderer which has Agg(anti grain geometry) Quality! with our PixelFarm's MiniAgg :) (https://github.com/PaintLab/PixelFarm)
-
Supported platforms: .Net Framework >= 2.0 or .Net Standard >= 1.3
See => LayoutFarm#99
Some screenshots of the current master.
Enable TrueType Hinting, Tahoma, 8 pts
Tahoma, 72 pts (TrueType Hinting: disabled)
Tahoma, 8 pts, (TrueType Hinting: disabled)
Tahoma, 11 pts (TrueType Hinting: disabled)
Kerning: Enabled
Subpixel Rendering
Tahoma, grey-scale vs lcd-effect subpixel rendering
lcd-effect subpixel rendering, Sov_Tahanamas font from https://www.f0nt.com/release/sov_thanamas/
A Multi-channel signed distance field (Msdf) Texture (https://github.com/Chlumsky/msdfgen)
Another Msdf Texture
An Android GLES2-based demo
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: The same technique as pic1, msjh.ttf, '啊rAbc' ,
Please note that baseline of 啊 is not correct
Advanced OpenFont Text Shaping
1. GSUB : Ligature features
pic 1: Showing GSUB's glyph ligature, see f-i
(see more : LayoutFarm#80 (comment))
2. GPOS
pic 2: Testing with Thai (complex script) glyph that require gpos table
3. GSUB : ccmp
pic 3: Testing with Thai glyphs (complex script), showing glyph substitution
4. GSUB and GPOS
pic 4: testing with Thai glyph (complex script)
pic 5: complex GSUB-GPOS, Sarabun font from https://github.com/cadsondemak/Sarabun
(see more: LayoutFarm#82 (comment))
Emojis and related features were contributed by @samhocevar.
pic 1: Segoe UI Symbol Normal, on Windows 7
pic 2: FireFoxEmoji.ttf from https://github.com/mozilla/fxemoji
pic 3: Segoe UI Emoji Normal, on Windows 10
Advanced Emoji Ligatures
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)
Typography can read CFF font(.otf)
In this version, the results are not hinted by CFF instructions, so they are not pixel-perfect.
pic 1: compare with Win7's NotePad, latin-modern-math-regular.otf, 18 pts
Further more=> Typography can read all advanced MathTable.
See its action here => CSharpMath
Roboto-Regular.woff2, Typography reads and restores woff2
see LayoutFarm#27
This is a snapshot of Html drawboard from (https://github.com/LayoutFarm/HtmlRenderer). The glyphs are generated/layouted with Typography, and rendered with 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.
The project is based on multiple open-sourced projects (listed below) all using permissive licenses.
A license for a whole project is MIT.
But if you use some part of the codebase, please check each source file's header for the licensing info if available.
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
Apache2, 2018, Apache/PDFBox Authors, https://github.com/apache/pdfbox
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
Unpack, Zlib,Brotli
MIT, 2018, SharpZipLib, https://github.com/icsharpcode/SharpZipLib
MIT, 2009, 2010, 2013-2016 by the Brotli Authors., https://github.com/google/brotli
MIT, 2017, brezza92 (C# port from original code, by hand), https://github.com/brezza92/brotli
MIT, 2019, master131, https://github.com/master131/BrotliSharpLib
Demo
MIT, 2017, Zou Wei, https://github.com/zwcloud, see more Zou Wei's GUI works at here and here