a visual truetype hinting tool for robofont · fixed startpoint try all points as startpoint find...

59
A Visual TrueType Hinting Tool for RoboFont Jérémie Hornus & Samuel Hornus – Robothon 2015

Upload: others

Post on 26-Jul-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

A Visual TrueType Hinting Tool for RoboFont

Jérémie Hornus & Samuel Hornus – Robothon 2015

Page 2: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

.TTF

?VTT FontLab

Page 3: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

RoboFont

FontLab

Page 4: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Contents

• Visual Interactive feedback• Quadratic Converter• From VGP to TT ASM• Inside the UFO• Inside the TTF

• Some tools to help the hinter’s work

Page 5: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

DEMO time

Page 6: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Cubic(PostScript)

QuadraticConverter

Quadratic(TrueType)

Page 7: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Interactive Feedback

User modiies Visual Glyph Program

Update TrueType Assembly

Generate Mini Font.TTF

FreeType/freetype-py

grid-itted outline& bitmap

Page 8: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Visual Glyph Program

Visual Commands:

• Align• Single Link• Double Link• Interpolate• Middle Delta• Final Delta

Page 9: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Visual Glyph Program

Visual Commands:

• Align• Single Link• Double Link• Interpolate• Middle Delta• Final Delta

Page 10: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Visual Glyph Program

Topological Sort

Grouping

TrueType Assembly

A before B?B before A?

Doesn’t matter?

Sorts commands by pairs according to

TYPE and POINTS involved.

Set of Rules

Groups consecutive commands having similar types (align, single, interpolate, etc.).

Process Batches

Page 11: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

BATCH

Page 12: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

lib

Page 13: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

.glif

com.fontlab.ttprogramVisual Glyph Programencoded in base 64

com.robofont.robohint.assemblyPlain TrueType Assembly

Page 14: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

ControlValueTable<CVT>

PreProgramor

ControlValueProgram<PREP>

FontProgram<FPGM>

<GASP>

GlyphAssembly<GLYF>

functions size-dependentrasterizercontrol

stems and zonesdeinitions

set stems and zonesaccording to the pixel size

.TTF

Page 15: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Helper Tools

Page 16: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Helper Tools

Auto-stemFinds typical stem widths

Page 17: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Helper Tools

Auto-hintGenerates a Visual Glyph Program

Auto-stemFinds typical stem widths

Page 18: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Helper Tools

Auto-hintGenerates a Visual Glyph Program

Stems and VGPprovide a

starting pointfor the fonthinting job

Auto-stemFinds typical stem widths

Page 19: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Helper Tools

Auto-matchTransfers VGP to another font [in progress]

Auto-hintGenerates a Visual Glyph Program

Stems and VGPprovide a

starting pointfor the fonthinting job

Auto-stemFinds typical stem widths

Page 20: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Defining a ‘stem’

‘stem’ = ‘special pair of control points’

Page 21: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Defining a ‘stem’

Configuration of two points A and B:

- Position

- In- and Out- Tangents

- Clockwise

A

B

Page 22: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Defining a ‘stem’

The two points A and B form a stem when:

A

B

Page 23: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Defining a ‘stem’

The two points A and B form a stem when:

A

B

- A and B have two parallel tangents

- A lies on the inkedside of B’s tangentand vice-versa

- Segment [AB]is fully inked

Page 24: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Finding ‘stems’

- A and B have two parallel tangents

- A lies on the inkedside of B’s tangentand vice-versa

- Segment [AB]is fully inked A

B

Find all stems and sort them intohorizontal stems and vertical stems.

Page 25: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Finding ‘stems’

B

A

Is AB a stem?horizontal: yesvertical: no

Page 26: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Auto-stem

[filling the CVT with relevant stem widths]

Page 27: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Auto-stem

1 Gather stem widths into an array(of numbers)

0 20 40 60 80 100

Page 28: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Auto-stem

1 Gather stem widths into an array(of numbers)

2 Cluster them into groups (k-means)

0 20 40 60 80 100

Page 29: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Auto-stem

1 Gather stem widths into an array(of numbers)

2 Cluster them into groups (k-means)

3 Take the mean of each group as arelevant stem width

Control Value Table

0 20 40 60 80 100

16 45 73 102

Page 30: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Auto-stem

1 Gather stem widths into an array(of numbers)

2 Cluster them into groups (k-means)

3 Take the mean of each group as arelevant stem width

Control Value Table

0 20 40 60 80 100

16 45 73 102

Page 31: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Auto-hinting

[Automatically generates a VGP]

Two steps:1. Analyse the glyph by structuring its

set of points2. Use this structure to generate the VGP

Page 32: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Alignments

horizontal alignments for vertical hinting

Page 33: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Alignments

vertical alignments for horizontal hinting

Page 34: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Alignments

abstracted

Page 35: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Groups

Page 36: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Groups

Page 37: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Groups

Page 38: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Groups

3 groups of alignments

Page 39: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Hinting the groups (in X)

R

RR

Page 40: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Hinting the groups (in X)

R

RR

I

Page 41: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Hinting alignments in a group (in X)

leader alignment;received theinterpolate command.

I

Page 42: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Hinting alignments in a group (in X)

S_X_70 S_X_70S_X_80

I

Page 43: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Hinting alignments in a group (in X)

Finally,the points in analignment aresingle-link’d.

S

S

Page 44: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

VGP transfer via contour matching

Page 45: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

VGP transfer via contour matching

Page 46: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

VGP transfer via contour matching

transfer

Page 47: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

VGP transfer via contour matching

1. Measuring dissimilarity of 2 points2. Matching 2 pointed contours

(with a startpoint)3. Matching 2 contours4. Matching 2 glyphs

Page 48: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

2 points dissimilarity

A

B

toA

tiA

toBti

B

We choose D(A,B) so that it is small when A

and B are close and have similar tangents.

D(A,B) =(

f(tiA, ti

B) + f(toA, to

B))

× ||A− B||2

where f(tA, tB) =2

1+ tA · tB

For example D(A,B) < D(A,C)

CtoC

tiC

Page 49: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Matching two pointed contours

startpoint of contour

What is a matching?

Page 50: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Matching two pointed contours

• Maps each point of source contour to apoint of target contour

Page 51: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Matching two pointed contours

• Maps each point of source contour to apoint of target contour

• Maps source startpoint to target startpoint• Crossing arrows are forbidden

Page 52: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Matching two pointed contours

Score of this pointed matching is∑

arrows

D( , )

D D D D D D D D

Page 53: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Matching two pointed contours

Find the best pointed matching (lowestscore) with dynamic programming

Page 54: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Matching two contours

Fixed startpoint

Try all points as startpoint

Page 55: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Matching two contours

Fixed startpoint

Try all points as startpoint

Find best matching by trying all pointedmatchings and picking the best one

Page 56: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Matching two glyphs

source glyphtarget glyph

Page 57: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Matching two glyphs

source glyph

Page 58: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

Matching two glyphs

source glyph

target glyph

Page 59: A Visual TrueType Hinting Tool for RoboFont · Fixed startpoint Try all points as startpoint Find best matching by trying all pointed matchings and picking the best one. Matching

VGP Transfer