PaintLab / PixelFarm

From Vectors to (sub) Pixels, C# 2D Rendering Library
Other
156 stars 21 forks source link

GLES2 Glyph SubPixel Rendering - Developing #3

Open prepare opened 7 years ago

prepare commented 7 years ago

GLES2 based-HtmlRenderer, early preview


gles2_html2

pic 1: render with OpenGLES2, Text is rendering with PixelFarm's MiniAgg+ the Typography.

html_gdi pic 2: render with GDI+ (System.Drawing)


see more about lcd technique =>https://www.grc.com/cttech.htm

prepare commented 7 years ago

This version GLES2 -texture glyphs are not crisp.

subpix06

prepare commented 7 years ago

subpix01 pic 1: snapshot

subpix04

pic 2: GLES2 glyph texture with subpixel rendering., (top) use color component1. (middle) use color component2, (bottom) use color component3.

subpix03

subpix05

pic 3: compare software-based (left) rendering (MiniAgg) and (right) the glyph-based GLES2 version


seperate by channel, similiar to CMYK

sep_channel1

pic 4: slash

sep_channel2 pic 5: Zoom of pic4


cmyk

_pic 6: CMYK color, from https://en.wikipedia.org/wiki/CMYK_color_model


cmyk_2 _pic 7: CMYK to RGB, from https://www.rapidtables.com/convert/color/cmyk-to-rgb.html

prepare commented 7 years ago

from the original article (http://www.antigrain.com/research/font_rasterization/) sample_arial_1tenth_shift

pic 1: original article image, Maxim's Agg, 0.1 px shift to right,

subpix07

pic 2: our implementation, each image is move to right side 0.1 px, with TrueType hint

subpix08 pic 3: each image is move to right side 0.1 px

subpix11

pic 4: each 's' is move to right side 0.1 px

subpix12

pic 5: each 's' is move to right side 1 px

prepare commented 7 years ago

TrueType Hinting (Only Vertical Hint) + SubPixel Rendering

subpix_15

pic 1: left => original subpix layout, middle => adjust to 0 or 0.5 or 1 px , right => adjust to 0 or 1 px

subpix16

pic 2: (1) => original subpix layout, (2)=> adjust to 0 or 0.5 or 1 px , (3)=> adjust to 0 or 1 px

prepare commented 7 years ago

TrueType Hinting (Only Vertical Hint) + SubPixel Rendering + adjust x only (not Y)

subpix_18

pic 1: TrueType Hinting +SubPixel + adjust to 0 or 0.5 or 1 px

subpix_19

pic 2: TrueType Hinting +SubPixel +adjust to 0 or 1 px

prepare commented 7 years ago

TrueType Hinting (Only Vertical Hint) + SubPixelRendering +Adjust X and Y

subpix_20

pic 1: TrueType Hinting +SubPixel +adjust X and Y to 0 or 1 px

More cripse!,

But please see oblique of 'x' or '%'. They are too weak! => so, fix it

subpix_20

pic 2: Zoom to 'x' and '%' from pic 1, too weak

prepare commented 7 years ago

TrueType Hinting (Vertical + Horizontal) + SubPixelRendering +Adjust X and Y

subpix_22

pic 1: TrueType Hinting (Both Vertical and Horizontal) +SubPixel +adjust X and Y to 0 or 1 px, need to adjust Y pos agian

subpix_23 pic 2: zoom pic 1

prepare commented 7 years ago

PixelFarm's AutoHint (Vertical Only) + SubPixelRendering +Adjust X and Y subpix_24

pic 1: snap Y to integer

subpix_25

pic 2: zoom of pic 1, TODO: => fix our AutoHint

prepare commented 7 years ago

subpix_31 pic 1: (1) gray scale, (2) subpix , (3) subpix + contrast filter value=30

prepare commented 7 years ago

Revisit this again...

subpix_26 pic 1: WinGdi+ vs MiniAgg


subpix_27

pic 1: CustomFit and GlyphSnap X and Y

prepare commented 7 years ago

Preview Latest AutoFit + SubPixelRendering

glyph_analysis_e_26

pic 1: Tahoma, 8 pt, (1) No AutoFit , (2) with AutoFit, Tahoma, 10pt, (3) No AutoFit, (4) with AutoFit

For this version, The AutoFit feature is nearly complete.

prepare commented 7 years ago

Software-based Renderer, PixelFarm

After software-based renderer is ready, the GLES2 version is easy.


autofit_a

pic 1: Tahoma, 8 pt, autofit + subpixel rendering with Typography


autofit_a2

pic 2: some bugs on left and right bearing, i-a space


autofit_a3

pic 3: some i-a-i sequence, some bugs or i-a,and a-i


no_autofit_a6

pic 4: some i-a-i sequence, no horizontal fit alignment, exact x pos


autofit_a5

pic 5: iiii sequence


autofit_a7

pic 6: compare no horizontal fit(1) and horizontal fit(2), shows inter-glyph bugs in (2)

prepare commented 7 years ago

Fine Horizontal Fit Alignment

h_fit01

pic 1: horizontal fit alignment, with vertical autofit and subpixel rendering, Tahoma 8 pt

from pic1,


autofit_a8 pic 2: show long text


autofit_a10 pic 3: with vertical autofit, see horizontal stems of e t and f

prepare commented 7 years ago

Exact Horizontal Position (no Horizontal Fit), Tahoma 8 pts

Vertical Fit only, Tahoma 8 pts, gray-scale (upper) vs subpixel rendering.

without horizontal fitting alignment,you can see the blurriness.

autofit_no_h_fit

pic 1: i-i-i sequence

from pic 1, the i-i-i seq of Tahoma 8 pt shows color fringe and blurriness

autofit_no_h_fit_2

pic 2: e-e-f-f-t-t sequence

prepare commented 7 years ago

Preview, Gdi+ vs the Typography

Windows Gdi+ image (SubPixel Rendering, LCD technique) and its zoom pic. vs PixelFarm's Typography Glyph Rendering, with Vertical AutoFit + Horizontal Fit alignment. Tahoma 8 pts.

autofit_hfit01

pic 1: upper(1) Gdi+ vs (2) Typography subpixel (lcd) rendering vs (3) Typography gray-scale

prepare commented 7 years ago

Tahoma 8 pts,

autofit_f1

pic 1: vertical-autofit, and horizontal fit alignment


autofit_f3

pic 2: vertical-autofit, NO horizontal fit alignment

autofit_f2

pic 3: vertical-autofit, and horizontal fit alignment


prepare commented 6 years ago

The HtmlRenderer example!

html_renderer_with_selection2

pic 1: HtmlRenderer on GLES2 surface, text are renderered with the Typography

also, please note the text selection on the Html Surface.

(HtmlRender => https://github.com/LayoutFarm/HtmlRenderer,

Typography => https://github.com/LayoutFarm/Typography)

prepare commented 5 years ago

Nov 2018, HtmlRenderer Example

GLES render surface renders font with Lcd-effect , subpixel-rendering glyph texture (https://github.com/PaintLab/PixelFarm/issues/16).

The glyph texture is created with Typography lib.

(Default font of these Html pages are 'Tahoma')

2018-11-30_09-37-10

pic 1: GLES vs GDI render surface


2018-11-30_09-40-11

pic 2: from pic 1, screen comparison


gdi_htmlbox

pic 3: from 1, GDI render surface


gl_html_box

pic 4: from 1, GLES render surface


gl_html_box2

pic 5: from 4, zoom in