diff --git a/pdf/PDF.pdf b/pdf/PDF.pdf new file mode 100644 index 0000000000000000000000000000000000000000..03f08cd9504070a5b38da33745aae3b3977b055b Binary files /dev/null and b/pdf/PDF.pdf differ diff --git a/pdf/pdf.html b/pdf/pdf.html index 068a68e2a12adb44841a8cbe6269fa641b28a33f..9f34d859223fb87e2859294c24497395da35e71e 100644 --- a/pdf/pdf.html +++ b/pdf/pdf.html @@ -232,14 +232,7 @@ endobj --- -# Content - -Text (`w` = line width, `Tf` = font, `TL` = leading, `Tj` = text) -```html -stream -BT 1 0 0 1 22 20 cm 1 w /F 12 Tf 14.4 TL (Hello world)Tj ET -endstream -``` +# Drawing Drawing (`rg` = background color, `re` = rectangle, `b` = painting mode) ```html @@ -248,7 +241,7 @@ stream endstream ``` -<img src="images/rectangle.png" width="20%"> +<img src="images/rectangle.png" width="30%"> --- @@ -305,7 +298,7 @@ class: center, middle # Text with default encoding / fonts -Can use embedd default fonts (`Helvetica`) with default encoding `WinAnsiEncoding`. +Choose predefined font (`Helvetica`) & predefined encoding (`WinAnsiEncoding`). ```html 4 0 obj @@ -316,7 +309,7 @@ endobj endobj ``` -Then print text like: +Then print text like (`w` = line width, `Tf` = font, `TL` = leading, `Tj` = text) ```html 6 0 obj <</Length 59>> @@ -434,18 +427,25 @@ What about suficient? | hmtx | width of glyphs | | glyf | list of glyph data blocks | -In short: Read out tables, patch them together differently, hope offsets work. - --- -# Subsetting - -Fonts usually have 100's of glyphs. -Do we need more than 60? +# Overview `ttf` processing +Binary read out: +- Read out table directory to get offset / type of tables +- Read out each table (possibly multiple formats; `cmap` has 4!) +Interpret: +- Split `glyph` table as mandated by `loca` +- Get character widths as defined by `hhea` and `maxp` +- Use `post` and `cmap` to get unicode per `glyph` +Write back: +- Create subset with `glyphs` we actually need +- Correct "summary" tables (like #characters in font) +- Recreate binary file +In short: Read out tables, patch them together differently, pray everything works. ---