an overview of opentype - pan localization

52
An Overview of An Overview of OpenType OpenType Ali Basit Ali Basit Lead Software Test Engineer Lead Software Test Engineer Global Infrastructure and Font Technology Global Infrastructure and Font Technology Microsoft Corp. Microsoft Corp.

Upload: others

Post on 12-Sep-2021

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: An Overview of OpenType - PAN Localization

1

An Overview of An Overview of OpenTypeOpenType

Ali BasitAli BasitLead Software Test EngineerLead Software Test EngineerGlobal Infrastructure and Font TechnologyGlobal Infrastructure and Font TechnologyMicrosoft Corp.Microsoft Corp.

Page 2: An Overview of OpenType - PAN Localization

2

ObjectiveObjective

Overview of OpenType technologyOverview of OpenType technologyTools, resources and support available Tools, resources and support available from Microsoft for making OpenType from Microsoft for making OpenType fontsfonts

Page 3: An Overview of OpenType - PAN Localization

3

Why/Benefits of OpenType?Why/Benefits of OpenType?

Single file format that builds on the two existing Single file format that builds on the two existing formats formats Provides architecture for supporting complex Provides architecture for supporting complex scripts and advanced typographyscripts and advanced typographyOpenType fonts are UnicodeOpenType fonts are Unicode--basedbasedBetter protection of fontsBetter protection of fontsSupport on multiple platforms Support on multiple platforms

Fonts may contain either TrueType or PostScript (CFF) outlines.

The OpenType Layout model provides a powerful architecture for supporting complex scripts and advanced typography.

OpenType allow a rich mapping between characters and glyphs. This enables support for ligatures, positional forms, alternates, and other substitutions.

Page 4: An Overview of OpenType - PAN Localization

4

Adoption of OpenTypeAdoption of OpenType

OpenType fonts are backwards compatibleOpenType fonts are backwards compatibleAll fonts shipped by Microsoft are OpenTypeAll fonts shipped by Microsoft are OpenType

Page 5: An Overview of OpenType - PAN Localization

5

OpenType File FormatOpenType File Format

Extension of existing TrueType formatExtension of existing TrueType formatan OpenType font will containan OpenType font will contain

TrueType outline data or PostScript (CFF) TrueType outline data or PostScript (CFF) outlineoutlinePLUS traditional TrueType tables like cmap, PLUS traditional TrueType tables like cmap, head, hhea, name, head, hhea, name, hmtxhmtx, maxp, post, and , maxp, post, and OS/2.OS/2.DSIG table.DSIG table.

OpenType Tables,Required tablescmap Character to glyph mappinghead Font headerhhea Horizontal headerhmtx Horizontal metricsmaxp Maximum profile name Naming tableOS/2 OS/2 and Windows specific metricspost PostScript information

DSIG table differentiates TrueType and OpenType In the new spec this definition is changing. Now OpenType font must also contain a least two of the Advanced Typographic Tables discussed in the next slide.

Page 6: An Overview of OpenType - PAN Localization

6

OpenType Font OpenType Font Advanced Typographic TablesAdvanced Typographic Tables

GDEF GDEF –– Glyph DefinitionGlyph DefinitionGSUB GSUB –– Glyph SubstitutionGlyph SubstitutionGPOS GPOS –– Glyph PositioningGlyph PositioningBASE BASE –– Baseline AdjustmentBaseline AdjustmentJSTF JSTF -- JustificationJustification

Page 7: An Overview of OpenType - PAN Localization

7

Font Metrics Font Metrics –– head tablehead table

unitsPerEmunitsPerEmSpecifies the emSpecifies the em--height of the font a power of height of the font a power of 2 (2048)2 (2048)

lowestRecPPEMlowestRecPPEMSpecifies the smallest readable size of the font, Specifies the smallest readable size of the font, in pixels. This value is ignored for bitmap in pixels. This value is ignored for bitmap fonts.fonts.

Page 8: An Overview of OpenType - PAN Localization

8

Font Metrics Font Metrics –– hhea tablehhea table

Ascender, Descender, LineGapAscender, Descender, LineGapSpecifies the Macintosh ascender, descender Specifies the Macintosh ascender, descender values for the font.values for the font.

caretSlopeRise, caretSlopeRuncaretSlopeRise, caretSlopeRunUsed to calculate the slope of the cursor Used to calculate the slope of the cursor (rise/run) For example, the value for a non(rise/run) For example, the value for a non--italicized Latin font is (0,1) while an italicized italicized Latin font is (0,1) while an italicized Latin font might specify a value of (2,5). Latin font might specify a value of (2,5).

Page 9: An Overview of OpenType - PAN Localization

9

Font Metrics Font Metrics –– cmap tablecmap tablecmap subtable for both Windows & Maccmap subtable for both Windows & MacFormat 4: Windows subtableFormat 4: Windows subtable

platform id 3, encoding id 1 for text font, 0 for platform id 3, encoding id 1 for text font, 0 for symbolsymbolsupports double byte glyph indicessupports double byte glyph indices

Format 0: Macintosh subtableFormat 0: Macintosh subtableplatform id 1, encoding id 0platform id 1, encoding id 0supports single byte glyph indicessupports single byte glyph indices

Keep in mind cross-platform compatibility therefore cmap subtable for both Windows & Mac

Page 10: An Overview of OpenType - PAN Localization

10

Font Metrics Font Metrics –– name tablename tablePlatform and Encoding ID strings must match Platform and Encoding ID strings must match those in the those in the cmapcmap tabletableProvide Copyright and Trademark information Provide Copyright and Trademark information as appropriateas appropriateAdditional language strings for platform 3 could Additional language strings for platform 3 could be addedbe addedFollow spec requirements for name string Follow spec requirements for name string conventionsconventionsVersion number string should always read Version number string should always read ““Version Version n.nnn.nn””

Page 11: An Overview of OpenType - PAN Localization

11

Font Metrics Font Metrics –– post tablepost tableitalicAngle in counteritalicAngle in counter--clockwise degrees. clockwise degrees.

Matches caretSlopeRise/caretSlopeRun in hhea tableMatches caretSlopeRise/caretSlopeRun in hhea tableUnderline position and thickness in FUnitsUnderline position and thickness in FUnitsPost names: Post names:

Follow AdobeFollow Adobe®®'s PostScript's PostScript®® glyph naming glyph naming conventions conventions use Unicode and glyph names reference manual use Unicode and glyph names reference manual http://partners.adobe.com/asn/developer/type/unichttp://partners.adobe.com/asn/developer/type/unicodegn.htmlodegn.html

Page 12: An Overview of OpenType - PAN Localization

12

Font Metrics Font Metrics –– OS/2 tableOS/2 table

WeightClassWeightClassSpecifies the weight of the font in the range 0 to 900 Specifies the weight of the font in the range 0 to 900 (for example, 400 is normal and 700 is bold). (for example, 400 is normal and 700 is bold).

fsType fsType Font embedding and licensing rights. Fonts with no Font embedding and licensing rights. Fonts with no fsType bits set indicate that they can be embedded fsType bits set indicate that they can be embedded and permanently installed on the remote system. If and permanently installed on the remote system. If multiple embedding bits are set, the multiple embedding bits are set, the leastleast restrictive restrictive license granted takes precedence. license granted takes precedence.

Page 13: An Overview of OpenType - PAN Localization

13

Font Metrics Font Metrics –– OS/2 (Cont)OS/2 (Cont)PANOSEPANOSE: :

Used for font mapping.Used for font mapping.fsSelectionfsSelection: :

should be in sync with macStyle field in head should be in sync with macStyle field in head table.table.

sTypoAscender, sTypoDescender, sTypoLineGapsTypoAscender, sTypoDescender, sTypoLineGaptypographic values left up to the designertypographic values left up to the designer

WinAscent, WinDescent: WinAscent, WinDescent: Specifies the Windows Specifies the Windows ascender descender value for the font. ascender descender value for the font.

Page 14: An Overview of OpenType - PAN Localization

14

Font Metrics Font Metrics –– OS/2 (Cont)OS/2 (Cont)

ulUnicodeRangeulUnicodeRangeTo specify the Unicode blocks or ranges covered by To specify the Unicode blocks or ranges covered by the font file in the 'cmap' subtable.the font file in the 'cmap' subtable.

ulCodePageRangeulCodePageRangeTo specify the codepages supported by the font file To specify the codepages supported by the font file for Windows platform. for Windows platform.

Page 15: An Overview of OpenType - PAN Localization

15

Font Metrics Font Metrics –– gasp tablegasp tableChoose settings according to fontChoose settings according to font’’s hints and/or s hints and/or bitmapsbitmapsTurn off gray scale at bitmap sizesTurn off gray scale at bitmap sizes

Page 16: An Overview of OpenType - PAN Localization

16

OpenType Font OpenType Font Advanced Typographic TablesAdvanced Typographic Tables

GDEF GDEF –– Glyph DefinitionGlyph DefinitionGSUB GSUB –– Glyph SubstitutionGlyph SubstitutionGPOS GPOS –– Glyph PositioningGlyph PositioningBASE BASE –– Baseline AdjustmentBaseline AdjustmentJSTF JSTF -- JustificationJustification

AKA OpenType Layout tables

Page 17: An Overview of OpenType - PAN Localization

17

GDEF GDEF –– Glyph definitionGlyph definition

classifies the different types of glyphs in the font classifies the different types of glyphs in the font Base glyph (single character, spacing glyph) Base glyph (single character, spacing glyph) Ligature glyph (multiple character, spacing glyph) Ligature glyph (multiple character, spacing glyph) Mark glyph (nonMark glyph (non--spacing combining glyph) spacing combining glyph) Component glyph (part of single character, spacing Component glyph (part of single character, spacing glyph)glyph)

Page 18: An Overview of OpenType - PAN Localization

18

GDEF (continued)GDEF (continued)

identifies all attachment points on the glyphs identifies all attachment points on the glyphs performance enhancement performance enhancement -- streamlines data access streamlines data access and bitmap caching and bitmap caching

contains positioning data for ligature carets contains positioning data for ligature carets classifies mark glyphs classifies mark glyphs

helps group together marks that are positioned helps group together marks that are positioned similarly similarly –– class base operationsclass base operations

Page 19: An Overview of OpenType - PAN Localization

19

GSUB GSUB –– Glyph substitutionGlyph substitution

Single substitution (oneSingle substitution (one--toto--one)one)

Ligature Ligature (many(many--toto--one)one)

Multiple Multiple (one(one--toto--many)many)

Page 20: An Overview of OpenType - PAN Localization

20

More Substitution ExamplesMore Substitution Examples

Positional form Positional form –– glyph glyph is substituted based on is substituted based on its contextits context

Alternate form Alternate form –– a single a single letter may have two or letter may have two or more shapes from which more shapes from which to chooseto choose

Page 21: An Overview of OpenType - PAN Localization

21

GSUB (continued)GSUB (continued)

Alternate Alternate (many forms of one (many forms of one glyph)glyph)

ContextualContextual

Page 22: An Overview of OpenType - PAN Localization

22

GPOS GPOS –– Glyph PositioningGlyph Positioning

Single adjustment Single adjustment –– e.g. e.g. superscript/ subscript, or superscript/ subscript, or width of spacewidth of space

Pair adjustment Pair adjustment ––kerningkerning

Page 23: An Overview of OpenType - PAN Localization

23

GPOS (continued)GPOS (continued)

Cursive attachment Cursive attachment ––nastaliq nastaliq

Mark to base Mark to base

Mark to ligatureMark to ligature

Page 24: An Overview of OpenType - PAN Localization

24

GPOS (continued)GPOS (continued)

Mark to markMark to mark

ContextualContextual

Page 25: An Overview of OpenType - PAN Localization

25

BASE BASE –– Baseline AdjustmentBaseline Adjustment

used to align glyphs of different scripts and sizes used to align glyphs of different scripts and sizes in a line of text in a line of text provides minimum and maximum glyph extent provides minimum and maximum glyph extent values values

Page 26: An Overview of OpenType - PAN Localization

26

JSTF JSTF -- JustificationJustification

provides font developers with additional control provides font developers with additional control over glyph substitution and positioning in over glyph substitution and positioning in justified text justified text

Page 27: An Overview of OpenType - PAN Localization

27

Digital SignatureDigital Signature

DSIG table differentiates TrueType DSIG table differentiates TrueType and OpenTypeand OpenTypeprovides traceabilityprovides traceabilityfont must pass file integrity testsfont must pass file integrity testssigning tools available on websitesigning tools available on website

Page 28: An Overview of OpenType - PAN Localization

28

Tools for building OpenType fontsTools for building OpenType fonts

VOLTVOLT: Visual OpenType Layout Tool: Visual OpenType Layout ToolVTTVTT: Visual TrueType tool for hinting OpenType fonts: Visual TrueType tool for hinting OpenType fontsFont ValidatorFont Validator: Tool for validating OpenType fonts. : Tool for validating OpenType fonts. OTLSIGNOTLSIGN: Tool for adding a digital signature.: Tool for adding a digital signature.CacheTTCacheTT: Tool for adding LTSH, VDMX, and hdmx : Tool for adding LTSH, VDMX, and hdmx tables.tables.FPEFPE: Tool for name table modifications/: Tool for name table modifications/localizlocalizCmapeditCmapedit: Tool for editing cmap table.: Tool for editing cmap table.TTFDumpTTFDump: For dumping low level table information: For dumping low level table informationAnd many more And many more ……

Tools available for building OpenType fonts supporting Arabic fonts are the same used for the creation of all OpenType Layout fonts. The tools listed below are available from the Microsoft Typography Web site. ADDTABLE - A tool for adding tables to existing fonts. The tool properly updates offset entries and checksum values. TTOASM (and TTODASM) - Assembler/disassembler of OpenType Layout tables. These tools create binary table files that can then be added to an existing font using the ADDTABLE tool. VOLT (Visual OpenType Layout Tool) - This tool is used to visually specify ligatures, other glyph substitution operations, and glyph positioning operations. The tool automatically builds the source files required for the TTOASM assembler. VTT (Visual TrueType) - This tool is used for hinting OpenType fonts, and also includes the TTOASM tool. OTLSIGN (OpenType Font Signing Tool) - This tool is used to add a digital signature to OpenType fonts, indicating the publisher and "sealing" the bits of the font.

Page 29: An Overview of OpenType - PAN Localization

29

ResourcesResources

www.microsoft.com/www.microsoft.com/opentypeopentype//

Page 30: An Overview of OpenType - PAN Localization

30

Question?

Break

Page 31: An Overview of OpenType - PAN Localization

31

ObjectiveObjective

Overview of tools & technologies available Overview of tools & technologies available for building OpenType fonts.for building OpenType fonts.

HintingHinting

VTTVTT

VOLTVOLT

Font ValidatorFont Validator

CacheTTCacheTT

FPEFPE

CmapeditCmapedit

TTFDumpTTFDump

KOALATKOALAT

Page 32: An Overview of OpenType - PAN Localization

32

Overview of HintingOverview of Hinting

Page 33: An Overview of OpenType - PAN Localization

33

What is Hinting?What is Hinting?TechnicalTechnical: : Hinting is information included in a font file. Hinting is information included in a font file. The rasterizer uses this extra information along with the The rasterizer uses this extra information along with the glyph outlines, to make the best decisions about which glyph outlines, to make the best decisions about which pixels to turn on and off when the glyphs are displayed on pixels to turn on and off when the glyphs are displayed on screenscreenArtistic: Artistic: Hinting is the craft of making letterforms look Hinting is the craft of making letterforms look their best for Computer Screen display. their best for Computer Screen display.

Hinting is a mix of Technical & Artistic skillsHinting is a mix of Technical & Artistic skills

Page 34: An Overview of OpenType - PAN Localization

34

Why is hinting necessary?Why is hinting necessary?

When a glyph is scaled to the small point sizes of a When a glyph is scaled to the small point sizes of a low resolution computer screen there are very few low resolution computer screen there are very few pixels available to describe the glyphs shapes. pixels available to describe the glyphs shapes. Features such as stem and crossbar weights can Features such as stem and crossbar weights can become inconsistent or serif details for example can become inconsistent or serif details for example can become irregular, or in some cases disappear.become irregular, or in some cases disappear.

Page 35: An Overview of OpenType - PAN Localization

35

Page 36: An Overview of OpenType - PAN Localization

36

What does hinting do?What does hinting do?Good hinting improves typographic quality Good hinting improves typographic quality by controlling the followingby controlling the followingAlignmentAlignment (Baseline, Cap Height, x(Baseline, Cap Height, x--height, ascender descender)height, ascender descender)

Glyph shapeGlyph shape (overall consistency )(overall consistency )

WeightWeight Control Control (stems, rounds, serifs, between font families)(stems, rounds, serifs, between font families)

SymmetrySymmetry (very important at low screen sizes)(very important at low screen sizes)

SpacingSpacing (this is the key to how we read words)(this is the key to how we read words)

Preserves integrity of high resolution outlinePreserves integrity of high resolution outlineOverall goal to produce an even typographic color.Overall goal to produce an even typographic color.

Page 37: An Overview of OpenType - PAN Localization

37

Some general examplesSome general examples

Page 38: An Overview of OpenType - PAN Localization

38

AlignmentAlignment

Page 39: An Overview of OpenType - PAN Localization

39

Glyph ShapeGlyph Shape

Page 40: An Overview of OpenType - PAN Localization

40

Weight Weight

Page 41: An Overview of OpenType - PAN Localization

41

SymmetrySymmetry

Page 42: An Overview of OpenType - PAN Localization

42

SpacingSpacing

Page 43: An Overview of OpenType - PAN Localization

43

Typographic colorTypographic color

Page 44: An Overview of OpenType - PAN Localization

44

Hinting Hinting controlcontrol

Page 45: An Overview of OpenType - PAN Localization

45

DemoDemo

VTTVTT

Page 46: An Overview of OpenType - PAN Localization

46

VOLTVOLT

Visual tool for adding OpenType tables to fontsVisual tool for adding OpenType tables to fontsAllows for editing Allows for editing ‘‘cmapcmap’’ tabletableDoes not update Does not update ‘‘postpost’’ tabletableProofing tool for testing lookupsProofing tool for testing lookupsBased on glyph indicesBased on glyph indices

Page 47: An Overview of OpenType - PAN Localization

47

VOLTVOLT

OpenType layout data is organized by script, language OpenType layout data is organized by script, language system, typographic feature, and lookup system, typographic feature, and lookup

The OpenType Layout tables provide typographic information for properly positioning and substituting glyphs, operations that are required for accurate typography in many language environments. OpenType Layout data is organized by script, language system, typographic feature, and lookup.

Scripts are defined at the top level. A script is a collection of glyphs used to represent one or more languages in written form (see Figure 2a). For instance, a single script-Latin-is used to write English, French, German, and many other languages. In contrast, three scripts-Hiragana, Katakana, and Kanji-are used to write Japanese. With OpenType Layout, multiple scripts may be supported by a single font.

A language system may modify the functions or appearance of glyphs in a script to represent a particular language. For example, the eszet ligature is used in the German language system, but not in French or English (see Figure 2b). And the Arabic script contains different glyphs for writing the Farsi and Urdu languages. In OpenType Layout, language systems are defined within scripts.

A language system defines features, which are typographic rules for using glyphs to represent a language. Sample features are a "vert" feature that substitutes vertical glyphs in Japanese, a "liga" feature for using ligatures in place of separate glyphs, and a "mark" feature that positions diacritical marks with respect to base glyphs in Arabic (see Figure 2c). In the absence of language-specific rules, default language system features apply to the entire script. For instance, a default language system feature for the Arabic script substitutes initial, medial, and final glyph forms based on a glyph's position in a word.

Features are implemented with lookup data that the text-processing client uses to substitute and position glyphs. Lookups describe the glyphs affected by an operation, the type of operation to be applied to these glyphs, and the resulting glyph output.

Page 48: An Overview of OpenType - PAN Localization

48

DemoDemo

VOLTVOLT

Page 49: An Overview of OpenType - PAN Localization

49

Font ValidatorFont Validator

Tool designed for font test automation.Tool designed for font test automation.Font meets the Open Type SpecificationFont meets the Open Type SpecificationBuilt in help file.Built in help file.

DEMODEMO

Page 50: An Overview of OpenType - PAN Localization

50

Font Property EditorFont Property Editor

Allows you to edit fontAllows you to edit font’’s s name tablename tableLocalize name tableLocalize name tableOS/2 tableOS/2 table

DEMODEMO

Page 51: An Overview of OpenType - PAN Localization

51

Font tools in the futureFont tools in the future

Font Font DiffingDiffing tool tool Bitmap Comparison toolBitmap Comparison toolTestcaseTestcase Generator toolGenerator toolFont Specification verifierFont Specification verifier

And more And more ……..

Page 52: An Overview of OpenType - PAN Localization

52

QuestionsQuestions

www.microsoft.com/www.microsoft.com/opentypeopentype//