diff --git a/Package.swift b/Package.swift index 4c8fca0..373f505 100644 --- a/Package.swift +++ b/Package.swift @@ -159,7 +159,7 @@ let package = Package( // QuickDraw's C functions over Graphite2D, one `@c @implementation` each. .target( name: "GraphiteQuickDrawABI", - dependencies: ["CQuickDraw", "GraphiteCore", "Graphite2D"] + dependencies: ["CQuickDraw", "GraphiteCore", "Graphite2D", "GraphiteText"] ), .target( name: "GraphiteText", @@ -249,6 +249,6 @@ let package = Package( .testTarget(name: "GraphiteEventsTests", dependencies: ["GraphiteEvents"]), .testTarget(name: "GraphiteMemoryTests", dependencies: ["GraphiteMemory"]), .testTarget(name: "GraphiteMixedModeTests", dependencies: ["GraphiteMixedMode", "GraphiteMemory"]), - .testTarget(name: "GraphiteQuickDrawABITests", dependencies: ["GraphiteQuickDrawABI", "CQuickDraw"]) + .testTarget(name: "GraphiteQuickDrawABITests", dependencies: ["GraphiteQuickDrawABI", "CQuickDraw", "GraphiteCore", "GraphiteText"]) ] ) diff --git a/README.md b/README.md index 5879758..140d9a8 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Any UI it shows will be drawn with [Cacao](https://github.com/PureSwift/Cacao). | `GraphiteResources` | The Resource Manager: resource maps read with every offset checked and written back, resource files changed in memory and updated, the chain of open files with `Get` and `Get1` searches, and `STR#`, `STR ` and `vers` resources. | | `GraphiteAutomation` | The Apple Event Manager: descriptors, lists, records and Apple events as values; coercions between text, numbers, booleans, codes, lists, records and file types (`furl`, `fss `, `alis`, and the host's), with installed handlers; the application's handlers by class and ID with wildcards; events sent to itself, and the required events. | | `Graphite2D` | QuickDraw's pixels (1 to 8 bits indexed, 16 and 32 bits direct, big-endian on every CPU, in memory of its own or a program's), colors and the system's color tables, regions as real regions with QuickDraw's region records, patterns, transfer modes, ports, devices and offscreen worlds; drawing rectangles, ovals, round rectangles, arcs, polygons, regions and lines with the pen, and CopyBits, CopyMask and ScrollRect between any depths; PICT pictures, version 1 and 2, with PackBits and QuickTime-compressed images through a decoder the host gives. | -| `GraphiteText` | Fonts: faces and their metrics, the Font Manager's family numbers and names with the classic fonts' and their substitutes, a built-in bitmap system font (from Pomme), and QuickDraw's text in a port's font, face, size and mode, with the styles a face hasn't drawn from its plain glyphs; ATSUI-style layouts with styled runs, line breaking, measuring, hit testing and drawing, and the text in PICT pictures; and, with the `FreeType` trait (on by default), faces from TrueType, OpenType and other outline fonts, found by family name in the system's font folders. | +| `GraphiteText` | Fonts: faces and their metrics, the Font Manager's family numbers and names with the classic fonts' and their substitutes, a built-in bitmap system font (from Pomme) and `NFNT` bitmap fonts, and QuickDraw's text in a port's font, face, size and mode, with the styles a face hasn't drawn from its plain glyphs as Mac OS 9.2.2 drew them; ATSUI-style layouts with styled runs, line breaking, measuring, hit testing and drawing, and the text in PICT pictures; and, with the `FreeType` trait (on by default), faces from TrueType, OpenType and other outline fonts, found by family name in the system's font folders. | | `GraphiteSound` | The Sound Manager: sampled sounds from `'snd '` resources (formats 1 and 2, with the standard, compressed and extended headers) and AIFF and AIFF-C files, read to 16-bit PCM; the µ-law, A-law and IMA4 codecs (MACE is recognized but not decoded yet); sound channels with queued commands (`SndDoCommand`) including `callBackCmd`, `waitCmd` and `syncCmd`, immediate ones, volume, pan, pitch, loops and completion; a mixer that renders them to stereo float frames, for an audio device the host provides; and the frequencies of MIDI notes. | | `GraphiteWindows` | The Window Manager: windows of every class, from documents, dialogs and alerts to palettes, sheets and drawers, each with the standard Mac OS 8 and 9 frame or a window definition the host brings (the WDEF); the window list ordered by layer, `FrontWindow`, and the active document and the active palette; `FindWindow` and every part of a frame; showing, hiding, selecting, zooming between the user and standard states, collapsing; `MoveWindow`, `SizeWindow` and `SetWindowBounds`, with centering, cascading and the alert position; each window's content in an offscreen buffer with its visible region — what no window in front covers — its update region with `BeginUpdate` and `EndUpdate`, and the part of it the host is told to flush. | | `GraphiteMenus` | The Menu Manager: menus and their items — text in MacRoman, marks (the check mark and the diamond), icons, styles, keyboard equivalents with their modifiers, submenus by menu ID, command IDs — built with `AppendMenu`'s metacharacter strings or item by item; checked, enabled and disabled; the menu bar with `InsertMenu`'s order and its hierarchical list, `GetMenuHandle`, `MenuKey` and `EnableMenuCommand`; menu definitions (the MDEF) with the standard definition's sizes and item geometry; and `'MENU'` resources read with every field as the classic kept it, enable flags and submenus included. | diff --git a/ReferenceTests/Retro68/CMakeLists.txt b/ReferenceTests/Retro68/CMakeLists.txt index e75cb55..fc9a5d9 100644 --- a/ReferenceTests/Retro68/CMakeLists.txt +++ b/ReferenceTests/Retro68/CMakeLists.txt @@ -22,3 +22,4 @@ add_application(AppleEventParamsCapture AppleEventParamsCapture.c) add_application(QuickDrawDrawingCapture QuickDrawDrawingCapture.c) add_application(PolygonCapture PolygonCapture.c) add_application(CopyBitsCapture CopyBitsCapture.c) +add_application(TextCapture TextCapture.c TextCapture.r) diff --git a/ReferenceTests/Retro68/README.md b/ReferenceTests/Retro68/README.md index c19c88d..f7c7c5f 100644 --- a/ReferenceTests/Retro68/README.md +++ b/ReferenceTests/Retro68/README.md @@ -668,3 +668,40 @@ Mac OS 9.2.2 in UTM. It writes `CopyBits.txt`, kept here as `CopyBitsCaptureTests` makes the probe's calls through libQuickDraw and compares every line. The two with a source outside its bitmap differ: Graphite leaves the destination there. + +## Text + +`TextCapture.c` records `GetFontInfo`, `CharWidth`, `StringWidth`, `TextWidth` +and `MeasureText`, and what `DrawChar`, `DrawString` and `DrawText` draw: every +style, the text modes, `SpaceExtra`, `CharExtra` and sizes the font has not. It +draws in a font of its own, `GraphiteProbe`, a `FOND` and a 12 point `NFNT` in +`TextCapture.r`, so none of Apple's fonts is needed to draw the same again. It +ran from the Finder on Mac OS 9.2.2 in UTM. It writes `Text.txt`, kept here as +`Text-macos-9.2.2-ppc.txt` (CR line endings). + +- Bold drew the glyphs twice a pixel apart; italic moved a row a pixel right + for every two above the baseline, rounding down below it. Bold, extend and + outline widened a character by a pixel, shadow by two, outline with shadow by + three, and condense narrowed it by one. Italic and underline widened nothing, + and `GetFontInfo`'s `widMax` followed the same sums. +- Underline was a row below the baseline, left out beside the pixels of + descenders, before and after the italic slant; with outline or shadow it + started a pixel left of the pen. +- Outline and shadow surrounded the glyphs by one pixel up and left and one, + two or three down and right, and left the glyphs themselves white. +- A character the font lacks drew its missing symbol; a carriage return had no + width. +- `srcCopy` and the `not` modes drew the whole cell, from the pen over the + advance, or as far as the last glyph reached past it. +- `SpaceExtra` was summed in fixed point: widths dropped the fraction, and + drawing started from half a pixel. `CharExtra` did nothing in a `GrafPort`. +- A size the font lacked was the 12 point strike, styled first, stretched by + the ratio of the sizes in 16.16 fixed point, as `CopyBits` stretches. + Metrics rounded halves up; widths dropped the fraction. +- The pen's pattern, mode and size and the background pattern did nothing; a + hidden pen drew nothing and moved all the same; an open region recorded + nothing. + +`TextCaptureTests` makes the probe's calls through libQuickDraw and compares +every line. Three differ: a pixel at the right edge of bold condensed text, and +a few pixels of the two pictures shrunk to 9 points. diff --git a/ReferenceTests/Retro68/Text-macos-9.2.2-ppc.txt b/ReferenceTests/Retro68/Text-macos-9.2.2-ppc.txt new file mode 100644 index 0000000..f9861b7 --- /dev/null +++ b/ReferenceTests/Retro68/Text-macos-9.2.2-ppc.txt @@ -0,0 +1 @@ +GetFNum -> 1500 GetFontInfo, plain -> ascent 9, descent 3, widMax 10, leading 1 StringWidth, plain -> 46 MeasureText, plain -> 0 7 11 17 20 24 34 40 42 46 CharWidth of A, plain -> 7 CharWidth of space, plain -> 4 GetFontInfo, bold -> ascent 9, descent 3, widMax 11, leading 1 StringWidth, bold -> 55 MeasureText, bold -> 0 8 13 20 24 29 40 47 50 55 CharWidth of A, bold -> 8 CharWidth of space, bold -> 5 GetFontInfo, italic -> ascent 9, descent 3, widMax 10, leading 1 StringWidth, italic -> 46 MeasureText, italic -> 0 7 11 17 20 24 34 40 42 46 CharWidth of A, italic -> 7 CharWidth of space, italic -> 4 GetFontInfo, underline -> ascent 9, descent 3, widMax 10, leading 1 StringWidth, underline -> 46 MeasureText, underline -> 0 7 11 17 20 24 34 40 42 46 CharWidth of A, underline -> 7 CharWidth of space, underline -> 4 GetFontInfo, outline -> ascent 10, descent 4, widMax 11, leading 1 StringWidth, outline -> 55 MeasureText, outline -> 0 8 13 20 24 29 40 47 50 55 CharWidth of A, outline -> 8 CharWidth of space, outline -> 5 GetFontInfo, shadow -> ascent 10, descent 5, widMax 12, leading 1 StringWidth, shadow -> 64 MeasureText, shadow -> 0 9 15 23 28 34 46 54 58 64 CharWidth of A, shadow -> 9 CharWidth of space, shadow -> 6 GetFontInfo, condense -> ascent 9, descent 3, widMax 9, leading 1 StringWidth, condense -> 37 MeasureText, condense -> 0 6 9 14 16 19 28 33 34 37 CharWidth of A, condense -> 6 CharWidth of space, condense -> 3 GetFontInfo, extend -> ascent 9, descent 3, widMax 11, leading 1 StringWidth, extend -> 55 MeasureText, extend -> 0 8 13 20 24 29 40 47 50 55 CharWidth of A, extend -> 8 CharWidth of space, extend -> 5 GetFontInfo, bold italic -> ascent 9, descent 3, widMax 11, leading 1 StringWidth, bold italic -> 55 MeasureText, bold italic -> 0 8 13 20 24 29 40 47 50 55 CharWidth of A, bold italic -> 8 CharWidth of space, bold italic -> 5 GetFontInfo, bold underline -> ascent 9, descent 3, widMax 11, leading 1 StringWidth, bold underline -> 55 MeasureText, bold underline -> 0 8 13 20 24 29 40 47 50 55 CharWidth of A, bold underline -> 8 CharWidth of space, bold underline -> 5 GetFontInfo, bold outline -> ascent 10, descent 4, widMax 12, leading 1 StringWidth, bold outline -> 64 MeasureText, bold outline -> 0 9 15 23 28 34 46 54 58 64 CharWidth of A, bold outline -> 9 CharWidth of space, bold outline -> 6 GetFontInfo, outline shadow -> ascent 10, descent 6, widMax 13, leading 1 StringWidth, outline shadow -> 73 MeasureText, outline shadow -> 0 10 17 26 32 39 52 61 66 73 CharWidth of A, outline shadow -> 10 CharWidth of space, outline shadow -> 7 GetFontInfo, italic shadow -> ascent 10, descent 5, widMax 12, leading 1 StringWidth, italic shadow -> 64 MeasureText, italic shadow -> 0 9 15 23 28 34 46 54 58 64 CharWidth of A, italic shadow -> 9 CharWidth of space, italic shadow -> 6 GetFontInfo, italic underline -> ascent 9, descent 3, widMax 10, leading 1 StringWidth, italic underline -> 46 MeasureText, italic underline -> 0 7 11 17 20 24 34 40 42 46 CharWidth of A, italic underline -> 7 CharWidth of space, italic underline -> 4 GetFontInfo, underline shadow -> ascent 10, descent 5, widMax 12, leading 1 StringWidth, underline shadow -> 64 MeasureText, underline shadow -> 0 9 15 23 28 34 46 54 58 64 CharWidth of A, underline shadow -> 9 CharWidth of space, underline shadow -> 6 GetFontInfo, bold condense -> ascent 9, descent 3, widMax 10, leading 1 StringWidth, bold condense -> 46 MeasureText, bold condense -> 0 7 11 17 20 24 34 40 42 46 CharWidth of A, bold condense -> 7 CharWidth of space, bold condense -> 4 GetFontInfo, condense extend -> ascent 9, descent 3, widMax 10, leading 1 StringWidth, condense extend -> 46 MeasureText, condense extend -> 0 7 11 17 20 24 34 40 42 46 CharWidth of A, condense extend -> 7 CharWidth of space, condense extend -> 4 GetFontInfo, all -> ascent 10, descent 6, widMax 14, leading 1 StringWidth, all -> 82 MeasureText, all -> 0 11 19 29 36 44 58 68 74 82 CharWidth of A, all -> 11 CharWidth of space, all -> 8 CharWidth 32 -> 4 CharWidth 46 -> 4 CharWidth 65 -> 7 CharWidth 66 -> 7 CharWidth 87 -> 10 CharWidth 97 -> 6 CharWidth 102 -> 4 CharWidth 103 -> 6 CharWidth 105 -> 2 CharWidth 106 -> 3 CharWidth 90 -> 6 CharWidth 126 -> 6 CharWidth 13 -> 0 CharWidth 9 -> 6 CharWidth 0 -> 6 CharWidth 200 -> 6 TextWidth from 0 for 0 -> 0 TextWidth from 2 for 4 -> 23 GetFontInfo at 12 -> ascent 9, descent 3, widMax 10, leading 1 StringWidth, at 12 -> 46 MeasureText, at 12 -> 0 7 11 17 20 24 34 40 42 46 StringWidth, bold at 12 -> 55 MeasureText, bold at 12 -> 0 8 13 20 24 29 40 47 50 55 GetFontInfo at 24 -> ascent 18, descent 6, widMax 20, leading 2 StringWidth, at 24 -> 92 MeasureText, at 24 -> 0 14 22 34 40 48 68 80 84 92 StringWidth, bold at 24 -> 110 MeasureText, bold at 24 -> 0 16 26 40 48 58 80 94 100 110 GetFontInfo at 18 -> ascent 14, descent 5, widMax 15, leading 2 StringWidth, at 18 -> 69 MeasureText, at 18 -> 0 10 16 25 30 36 51 60 63 69 StringWidth, bold at 18 -> 82 MeasureText, bold at 18 -> 0 12 19 30 36 43 60 70 75 82 GetFontInfo at 9 -> ascent 7, descent 2, widMax 8, leading 1 StringWidth, at 9 -> 34 MeasureText, at 9 -> 0 5 8 12 15 18 25 30 31 34 StringWidth, bold at 9 -> 41 MeasureText, bold at 9 -> 0 6 9 15 18 21 30 35 37 41 GetFontInfo at 6 -> ascent 5, descent 2, widMax 5, leading 1 StringWidth, at 6 -> 23 MeasureText, at 6 -> 0 3 5 8 10 12 17 20 21 23 StringWidth, bold at 6 -> 27 MeasureText, bold at 6 -> 0 4 6 10 12 14 20 23 25 27 GetFontInfo at 36 -> ascent 27, descent 9, widMax 30, leading 3 StringWidth, at 36 -> 138 MeasureText, at 36 -> 0 21 33 51 60 72 102 120 126 138 StringWidth, bold at 36 -> 165 MeasureText, bold at 36 -> 0 24 39 60 72 87 120 141 150 165 GetFontInfo at 13 -> ascent 10, descent 3, widMax 11, leading 1 StringWidth, at 13 -> 49 MeasureText, at 13 -> 0 7 11 18 21 25 36 43 45 49 StringWidth, bold at 13 -> 59 MeasureText, bold at 13 -> 0 8 14 21 25 31 43 50 54 59 GetFontInfo at 0 -> ascent 9, descent 3, widMax 10, leading 1 StringWidth, at 0 -> 46 MeasureText, at 0 -> 0 7 11 17 20 24 34 40 42 46 StringWidth, bold at 0 -> 55 MeasureText, bold at 0 -> 0 8 13 20 24 29 40 47 50 55 StringWidth of one space, spExtra 2.5 -> 6 StringWidth of two spaces, spExtra 2.5 -> 13 StringWidth of three spaces, spExtra 2.5 -> 19 StringWidth, spExtra 2.5 -> 48 MeasureText, spExtra 2.5 -> 0 7 11 17 20 26 36 42 44 48 StringWidth of A space A space A, spExtra 0.25 -> 29 StringWidth of five spaces, spExtra 0.25 -> 21 StringWidth of three spaces, spExtra -1.5 -> 7 StringWidth with CharExtra 3 in a GrafPort -> 46 DrawChar A -> pen (16,15) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 001000000000000000000000 002800000000000000000000 004400000000000000000000 004400000000000000000000 007C00000000000000000000 004400000000000000000000 004400000000000000000000 004400000000000000000000 004400000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 DrawChar of a missing character -> pen (16,14) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 00F800000000000000000000 008800000000000000000000 008800000000000000000000 008800000000000000000000 008800000000000000000000 008800000000000000000000 008800000000000000000000 008800000000000000000000 00F800000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 DrawString -> pen (16,54) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 001038208080400000000000 002840008080000000000000 004440008080000000000000 0044F7A0888E400000000000 007C48A08881400000000000 004448A0948F400000000000 004448A0A291400000000000 004447A0C191580000000000 004440A0808F580000000000 000000A00000000000000000 000009A00000000000000000 000007C00000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 DrawString with missing characters -> pen (16,33) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 0079F7C00000000000000000 004514400000000000000000 004514400000000000000000 007914470000000000000000 004514408000000000000000 004514478000000000000000 004514488000000000000000 004514488000000000000000 0079F7C78000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 DrawText from 2 for 4 -> pen (16,31) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000104040000000000000000 000004040000000000000000 000004040000000000000000 003D04440000000000000000 004504440000000000000000 004504A40000000000000000 004505140000000000000000 003D060C0000000000000000 000504040000000000000000 000500000000000000000000 004D00000000000000000000 003E00000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 DrawString of nothing -> pen (16,8) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 DrawString overhanging the left edge -> pen (16,14) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 43A000000000000000000000 045000000000000000000000 048800000000000000000000 4F8800000000000000000000 44F800000000000000000000 448800000000000000000000 448800000000000000000000 448800000000000000000000 448800000000000000000000 400000000000000000000000 400000000000000000000000 800000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 DrawString past the right edge -> pen (16,107) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000004 00000000000000000000000A 000000000000000000000011 000000000000000000000011 00000000000000000000001F 000000000000000000000011 000000000000000000000011 000000000000000000000011 000000000000000000000011 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style plain -> pen (16,54) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 001038208080400000000000 002840008080000000000000 004440008080000000000000 0044F7A0888E400000000000 007C48A08881400000000000 004448A0948F400000000000 004448A0A291400000000000 004447A0C191580000000000 004440A0808F580000000000 000000A00000000000000000 000009A00000000000000000 000007C00000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style plain, short -> pen (16,24) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000001C00000000000000000 000002000000000000000000 000002000000000000000000 003CE7800000000000000000 004412000000000000000000 0044F2000000000000000000 004512000000000000000000 003D12000000000000000000 0004F2000000000000000000 000400000000000000000000 004400000000000000000000 003800000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style bold -> pen (16,63) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 00181E06060600C000000000 003C30000606000000000000 006630000606000000000000 00667DF606663CC000000000 007E3336066606C000000000 0066333606F63EC000000000 00663336079E66C000000000 006631F6070E66DC00000000 0066303606063EDC00000000 000000360000000000000000 000003360000000000000000 000001FC0000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style bold, short -> pen (16,27) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000700000000000000000 000000C00000000000000000 000000C00000000000000000 003E79F00000000000000000 00660CC00000000000000000 00667CC00000000000000000 0066CCC00000000000000000 003ECCC00000000000000000 00067CC00000000000000000 000600000000000000000000 006600000000000000000000 003C00000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style italic -> pen (16,54) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000103820808040000000000 000284000808000000000000 000888001010000000000000 00089EF41111C80000000000 001F12282220500000000000 001112282523D00000000000 002224505148A00000000000 002223D060C8AC0000000000 004440A0808F580000000000 000000A00000000000000000 000013400000000000000000 00000F800000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style italic, short -> pen (16,24) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 0000001C0000000000000000 000000200000000000000000 000000400000000000000000 00079CF00000000000000000 001104800000000000000000 00113C800000000000000000 002289000000000000000000 001E89000000000000000000 0004F2000000000000000000 000400000000000000000000 008800000000000000000000 007000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style underline -> pen (16,54) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 001038208080400000000000 002840008080000000000000 004440008080000000000000 0044F7A0888E400000000000 007C48A08881400000000000 004448A0948F400000000000 004448A0A291400000000000 004447A0C191580000000000 004440A0808F580000000000 000000A00000000000000000 00FFE9AFFFFFFC0000000000 000007C00000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style underline, short -> pen (16,24) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000001C00000000000000000 000002000000000000000000 000002000000000000000000 003CE7800000000000000000 004412000000000000000000 0044F2000000000000000000 004512000000000000000000 003D12000000000000000000 0004F2000000000000000000 000400000000000000000000 0045FFC00000000000000000 003800000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style outline -> pen (16,63) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 00383E0E0E0E01C000000000 006C620A0A0A014000000000 00D65E0E0A0A01C000000000 00BADFFE0AEA7DC000000000 00BA861A0AAA474000000000 0082DDDA0BBA7B4000000000 00BA555A0B5AC34000000000 00AA55DA0AEABB7C00000000 00AA561A09B2BB6400000000 00AA53DA0B1AC36400000000 00EE775A0E0E7FFC00000000 000005DA0000000000000000 000006260000000000000000 000003FC0000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style outline, short -> pen (16,27) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000F00000000000000000 000001800000000000000000 000001700000000000000000 007EFB700000000000000000 00C28E100000000000000000 00BAF7700000000000000000 00AB85400000000000000000 00BB75400000000000000000 00C375400000000000000000 007B85400000000000000000 00EAFDC00000000000000000 00BA00000000000000000000 00C600000000000000000000 007C00000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style shadow -> pen (16,72) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 003C1F81E0787803C0000000 006E318160585802C0000000 00D72F81E0585803C0000000 00BB6FFFE05FD9FBC0000000 00BB4387605DD91EC0000000 00836F77605DD9EEC0000000 00BB6F77605ADB0EC0000000 00BB2D7760575AEEFE000000 00BB2D87604F9AEEE6000000 00BB2DF7605FDB0EE6000000 00FF3DF7607CFBFFFE000000 00FF3D73607879FFFE000000 0000018CE000000000000000 000001FFE000000000000000 000000FFC000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style shadow, short -> pen (16,30) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 0000003C0000000000000000 000000600000000000000000 0000005C0000000000000000 007F7EDC0000000000000000 00C347840000000000000000 00BB7BDC0000000000000000 00BBC3DC0000000000000000 00BBBB580000000000000000 00C3BB580000000000000000 00FBC3580000000000000000 00FBFF780000000000000000 00BB7F780000000000000000 00C700000000000000000000 00FF00000000000000000000 007E00000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style condense -> pen (16,45) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 001071101020000000000000 002880101000000000000000 004480101000000000000000 0045FF1113A0000000000000 007CA3111060000000000000 0044A31293E0000000000000 0044A3145460000000000000 00449F183478000000000000 0044831013F8000000000000 000003000000000000000000 00002B000000000000000000 00001E000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style condense, short -> pen (16,21) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000007000000000000000000 000008000000000000000000 000008000000000000000000 003DDE000000000000000000 004428000000000000000000 0045E8000000000000000000 004628000000000000000000 003E28000000000000000000 0005E8000000000000000000 000400000000000000000000 004400000000000000000000 003800000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style extend -> pen (16,63) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 00101C040404008000000000 002820000404000000000000 004420000404000000000000 004479E40444388000000000 007C22240444048000000000 0044222404A43C8000000000 004422240514448000000000 004421E4060C449800000000 0044202404043C9800000000 000000240000000000000000 000002240000000000000000 000001D80000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style extend, short -> pen (16,27) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000600000000000000000 000000800000000000000000 000000800000000000000000 003C71E00000000000000000 004408800000000000000000 004478800000000000000000 004488800000000000000000 003C88800000000000000000 000478800000000000000000 000400000000000000000000 004400000000000000000000 003800000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style bold italic -> pen (16,63) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000181E06060600C00000000 0003C3000060600000000000 000CC60000C0C00000000000 000CCFBEC0CCC79800000000 001F8CCD819981B000000000 00198CCD81BD8FB000000000 0033199B03CF336000000000 003318FB0387336E00000000 0066303606063EDC00000000 000000360000000000000000 0000066C0000000000000000 000003F80000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style bold italic, short -> pen (16,27) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000060000000000000000 0000000C0000000000000000 000000180000000000000000 0007CF3E0000000000000000 001983300000000000000000 00199F300000000000000000 003366600000000000000000 001F66600000000000000000 00067CC00000000000000000 000600000000000000000000 00CC00000000000000000000 007800000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style bold underline -> pen (16,63) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 00181E06060600C000000000 003C30000606000000000000 006630000606000000000000 00667DF606663CC000000000 007E3336066606C000000000 0066333606F63EC000000000 00663336079E66C000000000 006631F6070E66DC00000000 0066303606063EDC00000000 000000360000000000000000 00FFFB36FFFFFFFE00000000 000001FC0000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style bold underline, short -> pen (16,27) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000700000000000000000 000000C00000000000000000 000000C00000000000000000 003E79F00000000000000000 00660CC00000000000000000 00667CC00000000000000000 0066CCC00000000000000000 003ECCC00000000000000000 00067CC00000000000000000 000600000000000000000000 0066FFF00000000000000000 003C00000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style bold outline -> pen (16,72) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 003C1F81E0787803C0000000 006630812048480240000000 00C32781E0484803C0000000 009967FFE04FC9FBC0000000 00994183204CC90E40000000 00816733204CC9E640000000 0099253320484B0640000000 0099253320430A667E000000 0099258320478A6662000000 009924F3204CCB0662000000 00FF3DF3207879FFFE000000 000001312000000000000000 000001846000000000000000 000000FFC000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style bold outline, short -> pen (16,30) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 0000003C0000000000000000 000000600000000000000000 0000004C0000000000000000 007F7ECC0000000000000000 00C143800000000000000000 009979CC0000000000000000 0099C1480000000000000000 009999480000000000000000 00C199480000000000000000 0079C1480000000000000000 00F97F780000000000000000 009900000000000000000000 00C300000000000000000000 007E00000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style outline shadow -> pen (16,81) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 003E0FE03E03E3E007C00000 006F18E02E02E2E005C00000 00D797E03E02E2E007C00000 00BBB7FFFE02FEE7F7C00000 00BBA1E1EE02EEE47DC00000 0083B7DDEE02EEE7BDC00000 00BBB7DDEE02D6EC3DC00000 00BBB7DDEE02BAEBBDFF0000 00BB9761EE027CEBBDE70000 00BB977DEE02FEEC3DE70000 00FF9F7DEE03FFEFFFFF0000 00FF9F5D6E03F7EFFFFF0000 00FF9F639E03E3E7FFFF0000 0000007FFE00000000000000 0000007FFE00000000000000 0000003FFC00000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style outline shadow, short -> pen (16,33) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 0000000F8000000000000000 000000188000000000000000 000000178000000000000000 007FBFB78000000000000000 00C3A3E18000000000000000 00BBBDF78000000000000000 00BBE1F78000000000000000 00BBDDF78000000000000000 00C3DDD70000000000000000 00FBE1D70000000000000000 00FBFFDF0000000000000000 00BBFFDF0000000000000000 00C7BFDF0000000000000000 00FF80000000000000000000 00FF80000000000000000000 007F00000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style italic shadow -> pen (16,72) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 0003C1F81E0787803C000000 0006E318160585802C000000 001D66F81E0D8D803C000000 00176DFFFE0BFBBF7C000000 00376870EC1BBBA3D8000000 0020EBDDDC17777BB8000000 006EFBDDDC36B7C3B8000000 005DD7BBB82BAF777F000000 00DDF7C3B867CF7773000000 00BBAEF7705FDD0EE7000000 00FFBFF7707E7DFFFF000000 00FF3EE6E07879FFFE000000 00000319E000000000000000 000003FFC000000000000000 000001FF8000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style italic shadow, short -> pen (16,30) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000030000000000000000 000000060000000000000000 0000000D0000000000000000 000FEFDB0000000000000000 003868D00000000000000000 002EFED70000000000000000 006EF0F70000000000000000 005DDDEE0000000000000000 0061DDEE0000000000000000 007BC3DC0000000000000000 01FBFFFC0000000000000000 01777F780000000000000000 018F00000000000000000000 01FE00000000000000000000 00FC00000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style italic underline -> pen (16,54) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000103820808040000000000 000284000808000000000000 000888001010000000000000 00089EF41111C80000000000 001F12282220500000000000 001112282523D00000000000 002224505148A00000000000 002223D060C8AC0000000000 004440A0808F580000000000 000000A00000000000000000 00FFD34FFFFFFFC000000000 00000F800000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style italic underline, short -> pen (16,24) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 0000001C0000000000000000 000000200000000000000000 000000400000000000000000 00079CF00000000000000000 001104800000000000000000 00113C800000000000000000 002289000000000000000000 001E89000000000000000000 0004F2000000000000000000 000400000000000000000000 0089FFFC0000000000000000 007000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style underline shadow -> pen (16,72) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 003C1F81E0787803C0000000 006E318160585802C0000000 00D72F81E0585803C0000000 00BB6FFFE05FD9FBC0000000 00BB4387605DD91EC0000000 00836F77605DD9EEC0000000 00BB6F77605ADB0EC0000000 00BB2D7760575AEEFC000000 00BB2D87604F9AEEE4000000 00BB2DF7605FDB0EE4000000 01FFFFF77FFFFFFFFC000000 000001734000000000000000 01FFFF8CFFFFFFFFFC000000 01FFFFFFFFFFFFFFFC000000 000000FFC000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style underline shadow, short -> pen (16,30) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000300000000000000000 000000600000000000000000 000000500000000000000000 007F7ED00000000000000000 00C347800000000000000000 00BB7BD00000000000000000 00BBC3D00000000000000000 00BBBB500000000000000000 00C3BB500000000000000000 00FBC3500000000000000000 01FBFFF00000000000000000 00BA00000000000000000000 01C7FFF00000000000000000 01FFFFF00000000000000000 007E00000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style bold condense -> pen (16,54) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 00183C30C0C0600000000000 003C6000C0C0000000000000 00666000C0C0000000000000 0066FFF0CCCF600000000000 007E6CF0CCC1E00000000000 00666CF0DECFE00000000000 00666CF0F3D9E00000000000 006667F0E1D9FC0000000000 006660F0C0CFFC0000000000 000000F00000000000000000 00000DF00000000000000000 000007E00000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style bold condense, short -> pen (16,24) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000001E00000000000000000 000003000000000000000000 000003000000000000000000 003EF7C00000000000000000 00661B000000000000000000 0066FB000000000000000000 00679B000000000000000000 003F9B000000000000000000 0006FB000000000000000000 000600000000000000000000 006600000000000000000000 003C00000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style condense extend -> pen (16,54) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 001038208080400000000000 002840008080000000000000 004440008080000000000000 0044F7A0888E400000000000 007C48A08881400000000000 004448A0948F400000000000 004448A0A291400000000000 004447A0C191580000000000 004440A0808F580000000000 000000A00000000000000000 000009A00000000000000000 000007C00000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style condense extend, short -> pen (16,24) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000001C00000000000000000 000002000000000000000000 000002000000000000000000 003CE7800000000000000000 004412000000000000000000 0044F2000000000000000000 004512000000000000000000 003D12000000000000000000 0004F2000000000000000000 000400000000000000000000 004400000000000000000000 003800000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style all -> pen (16,90) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 0003F07F807E01F9F800FC00 000678C3804E013938009C00 001C399F807E033B3800FC00 00133B3FFFFE027E7BFDFC00 00333A0F079E06667A1F3C00 00207A7CCF3C04CCFF9E7800 00667E7CCF3C0C84FC1E7800 004CFCF99E7C0861F33CFE00 00CCFCFC1E7818F1F33CF000 0099F9FF3CF813F3F079E200 01FFFFFF3CFFFFFFFFFFFE00 000000264980000000000000 01FFFFF0E3FFFFFFFFFFFE00 01FFFFFFFFFFFFFFFFFFFE00 01FFFFFFFFFFFFFFFFFFFE00 0000001FFF80000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 style all, short -> pen (16,36) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000008000000000000000 000FFBFD8000000000000000 00383A1D0000000000000000 00267F9D0000000000000000 00667C1F0000000000000000 004CF33E0000000000000000 0060F33E0000000000000000 0079F07C8000000000000000 01F9FFFF8000000000000000 013300000000000000000000 0187FFFF8000000000000000 01FFFFFF8000000000000000 01FFFFFF8000000000000000 00FF00000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 mode srcCopy -> pen (16,24) F0F0F0F0F0F0F0F0F0F0F0F0 F0F0F0F0F0F0F0F0F0F0F0F0 F0F0F0F0F0F0F0F0F0F0F0F0 F0F0F0F0F0F0F0F0F0F0F0F0 F0F0F0F0F0F0F0F0F0F0F0F0 F0F0F0F0F0F0F0F0F0F0F0F0 F0F0F0F0F0F0F0F0F0F0F0F0 F00001F0F0F0F0F0F0F0F0F0 F0000230F0F0F0F0F0F0F0F0 F0000230F0F0F0F0F0F0F0F0 F03CE7B0F0F0F0F0F0F0F0F0 F0441230F0F0F0F0F0F0F0F0 F044F230F0F0F0F0F0F0F0F0 F0451230F0F0F0F0F0F0F0F0 F03D1230F0F0F0F0F0F0F0F0 F004F230F0F0F0F0F0F0F0F0 F0040030F0F0F0F0F0F0F0F0 F0440030F0F0F0F0F0F0F0F0 F0380030F0F0F0F0F0F0F0F0 F0F0F0F0F0F0F0F0F0F0F0F0 F0F0F0F0F0F0F0F0F0F0F0F0 F0F0F0F0F0F0F0F0F0F0F0F0 F0F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F0F0F0F0F0F0F0F0F0F0F0F0 F0F0F0F0F0F0F0F0F0F0F0F0 F0F0F0F0F0F0F0F0F0F0F0F0 F0F0F0F0F0F0F0F0F0F0F0F0 F0F0F0F0F0F0F0F0F0F0F0F0 fore color red -> pen (16,24) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000001C00000000000000000 000002000000000000000000 000002000000000000000000 003CE7800000000000000000 004412000000000000000000 0044F2000000000000000000 004512000000000000000000 003D12000000000000000000 0004F2000000000000000000 000400000000000000000000 004400000000000000000000 003800000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 back color black, srcCopy -> pen (16,24) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 00FFFFC00000000000000000 00FFFFC00000000000000000 00FFFFC00000000000000000 00FFFFC00000000000000000 00FFFFC00000000000000000 00FFFFC00000000000000000 00FFFFC00000000000000000 00FFFFC00000000000000000 00FFFFC00000000000000000 00FFFFC00000000000000000 00FFFFC00000000000000000 00FFFFC00000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 back pattern, srcCopy -> pen (16,24) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000001C00000000000000000 000002000000000000000000 000002000000000000000000 003CE7800000000000000000 004412000000000000000000 0044F2000000000000000000 004512000000000000000000 003D12000000000000000000 0004F2000000000000000000 000400000000000000000000 004400000000000000000000 003800000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 pen pattern, mode and size -> pen (16,24) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000001C00000000000000000 000002000000000000000000 000002000000000000000000 003CE7800000000000000000 004412000000000000000000 0044F2000000000000000000 004512000000000000000000 003D12000000000000000000 0004F2000000000000000000 000400000000000000000000 004400000000000000000000 003800000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 pen hidden -> pen (16,24) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 clipped -> pen (16,54) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 0004C0000000000000000000 003C40000000000000000000 000440000000000000000000 000440000000000000000000 000440000000000000000000 000440000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 origin 4,2 -> pen (18,28) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000001C00000000000000000 000002000000000000000000 000002000000000000000000 003CE7800000000000000000 004412000000000000000000 0044F2000000000000000000 004512000000000000000000 003D12000000000000000000 0004F2000000000000000000 000400000000000000000000 004400000000000000000000 003800000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 spExtra 2.5 -> pen (16,39) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 003801C01C00000000000000 000400200200000000000000 003C01E01E00000000000000 004402202200000000000000 004402202200000000000000 003C01E01E00000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 spExtra 2.5, underline -> pen (16,39) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 003801C01C00000000000000 000400200200000000000000 003C01E01E00000000000000 004402202200000000000000 004402202200000000000000 003C01E01E00000000000000 000000000000000000000000 00FFFFFFFE00000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 spExtra 0.25 -> pen (16,45) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 006060303030000000000000 006060303030000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 underline over spaces and descenders -> pen (16,32) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 001000020000000000000000 002800000000000000000000 004400000000000000000000 004407820000000000000000 007C08820000000000000000 004408820000000000000000 004408820000000000000000 004407820000000000000000 004400820000000000000000 000000820000000000000000 00FFE8920000000000000000 0000070C0000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 underline, two DrawChars -> pen (16,20) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 003CE0000000000000000000 004410000000000000000000 0044F0000000000000000000 004510000000000000000000 003D10000000000000000000 0004F0000000000000000000 000400000000000000000000 0047F0000000000000000000 003800000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 italic, two DrawChars -> pen (16,25) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000110100000000000000000 000290100000000000000000 0008A0200000000000000000 0008A2200000000000000000 001F44400000000000000000 00114A400000000000000000 0022A2800000000000000000 0022C1800000000000000000 004501000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 size of the region of a DrawString -> 10 DrawString in an open region -> pen (16,24) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 size 24 -> pen (22,40) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 0000000003F0000000000000 0000000003F0000000000000 000000000C00000000000000 000000000C00000000000000 000000000C00000000000000 000000000C00000000000000 000FF0FC3FC0000000000000 000FF0FC3FC0000000000000 003030030C00000000000000 003030030C00000000000000 003030FF0C00000000000000 003030FF0C00000000000000 003033030C00000000000000 003033030C00000000000000 000FF3030C00000000000000 000FF3030C00000000000000 000030FF0C00000000000000 000030FF0C00000000000000 000030000000000000000000 000030000000000000000000 003030000000000000000000 003030000000000000000000 000FC0000000000000000000 000FC0000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 size 24, bold -> pen (22,46) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 00000000003F000000000000 00000000003F000000000000 0000000000F0000000000000 0000000000F0000000000000 0000000000F0000000000000 0000000000F0000000000000 000FFC3FC3FF000000000000 000FFC3FC3FF000000000000 003C3C00F0F0000000000000 003C3C00F0F0000000000000 003C3C3FF0F0000000000000 003C3C3FF0F0000000000000 003C3CF0F0F0000000000000 003C3CF0F0F0000000000000 000FFCF0F0F0000000000000 000FFCF0F0F0000000000000 00003C3FF0F0000000000000 00003C3FF0F0000000000000 00003C000000000000000000 00003C000000000000000000 003C3C000000000000000000 003C3C000000000000000000 000FF0000000000000000000 000FF0000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 size 18 -> pen (22,32) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 00000001E000000000000000 00000001E000000000000000 000000060000000000000000 000000060000000000000000 000000060000000000000000 001F8F8FC000000000000000 002080460000000000000000 002080460000000000000000 00208FC60000000000000000 00208FC60000000000000000 002090460000000000000000 001F90460000000000000000 001F90460000000000000000 00008FC60000000000000000 000080000000000000000000 000080000000000000000000 002080000000000000000000 001F00000000000000000000 001F00000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 size 18, bold -> pen (22,37) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000003C00000000000000 000000003C00000000000000 00000000E000000000000000 00000000E000000000000000 00000000E000000000000000 001FE3F1FC00000000000000 0038E038E000000000000000 0038E038E000000000000000 0038E3F8E000000000000000 0038E3F8E000000000000000 0038EE38E000000000000000 001FEE38E000000000000000 001FEE38E000000000000000 0000E3F8E000000000000000 0000E0000000000000000000 0000E0000000000000000000 0038E0000000000000000000 001F80000000000000000000 001F80000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 size 9 -> pen (22,20) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 00000C000000000000000000 000010000000000000000000 007BB8000000000000000000 004890000000000000000000 004F90000000000000000000 007C90000000000000000000 000B90000000000000000000 004800000000000000000000 007000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 size 9, bold -> pen (22,22) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000006000000000000000000 00000C000000000000000000 0079DE000000000000000000 00486C000000000000000000 004BEC000000000000000000 007B6C000000000000000000 0009EC000000000000000000 004800000000000000000000 007800000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 size 6 -> pen (22,16) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000180000000000000000000 000100000000000000000000 00EF80000000000000000000 00BD00000000000000000000 007D00000000000000000000 002000000000000000000000 00E000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 size 6, bold -> pen (22,18) 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 0000C0000000000000000000 000080000000000000000000 00FFC0000000000000000000 00FE80000000000000000000 007E80000000000000000000 003000000000000000000000 00F000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 done \ No newline at end of file diff --git a/ReferenceTests/Retro68/TextCapture.c b/ReferenceTests/Retro68/TextCapture.c new file mode 100644 index 0000000..b088459 --- /dev/null +++ b/ReferenceTests/Retro68/TextCapture.c @@ -0,0 +1,282 @@ +/* + * Captures QuickDraw's text: what GetFontInfo, CharWidth, StringWidth, + * TextWidth and MeasureText give, and what DrawChar, DrawString and DrawText + * draw, in every style, in the text modes, with SpaceExtra and CharExtra, and + * at sizes the font has not. The font is the probe's own, in TextCapture.r. + * It writes "Text.txt" next to itself and refuses to run if that file is + * already there. The file is flushed after every line, so a call that crashes + * leaves the lines before it. + * + * Everything is drawn in a port of the probe's own over its own 96 by 32 + * bitmap, never the screen. A picture's line gives the bitmap's 32 rows, each + * 24 hex digits, the high bit leftmost. The pen starts at h 8, v 16. + */ +#include +#include +#include +#include +#include +#include + +#define ROW 12 + +static short out; +static short family; +static GrafPort port; +static unsigned char pixels[ROW * 32]; + +static const Pattern half = { { 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55 } }; + +static void line(const char *text) +{ + long count = strlen(text); + FSWrite(out, &count, text); + count = 1; + FSWrite(out, &count, "\r"); + FlushVol(0, 0); +} + +static void plain(void) +{ + Rect box = { 0, 0, 32, 96 }; + BitMap bits; + memset(pixels, 0, sizeof pixels); + InitPort(&port); + bits.baseAddr = (Ptr)pixels; + bits.rowBytes = ROW; + bits.bounds = box; + SetPortBits(&bits); + port.portRect = box; + RectRgn(port.visRgn, &box); + TextFont(family); + TextSize(12); + MoveTo(8, 16); +} + +/* The picture, and where the pen ended. */ +static void picture(const char *label) +{ + char text[1000]; + int used, row, i; + used = sprintf(text, "%s -> pen (%d,%d)", label, port.pnLoc.v, port.pnLoc.h); + for (row = 0; row < 32; row++) { + used += sprintf(text + used, " "); + for (i = 0; i < ROW; i++) + used += sprintf(text + used, "%02X", pixels[row * ROW + i]); + } + line(text); +} + +static void number(const char *label, long value) +{ + char text[200]; + sprintf(text, "%s -> %ld", label, value); + line(text); +} + +static void info(const char *label) +{ + FontInfo f; + char text[200]; + GetFontInfo(&f); + sprintf(text, "%s -> ascent %d, descent %d, widMax %d, leading %d", + label, f.ascent, f.descent, f.widMax, f.leading); + line(text); +} + +static const struct { const char *name; short face; } faces[] = { + { "plain", 0 }, { "bold", 1 }, { "italic", 2 }, { "underline", 4 }, + { "outline", 8 }, { "shadow", 16 }, { "condense", 32 }, { "extend", 64 }, + { "bold italic", 3 }, { "bold underline", 5 }, { "bold outline", 9 }, + { "outline shadow", 24 }, { "italic shadow", 18 }, { "italic underline", 6 }, + { "underline shadow", 20 }, { "bold condense", 33 }, { "condense extend", 96 }, + { "all", 127 }, +}; +#define FACES ((int)(sizeof faces / sizeof faces[0])) + +static const unsigned char sample[] = "\pAfgj Wai."; +static const unsigned char pair[] = "\pgaf"; + +static void measures(const char *label) +{ + char text[400]; + short locations[16]; + int used, i; + sprintf(text, "StringWidth, %s", label); + number(text, StringWidth(sample)); + memset(locations, 0, sizeof locations); + MeasureText(sample[0], (Ptr)(sample + 1), (Ptr)locations); + used = sprintf(text, "MeasureText, %s ->", label); + for (i = 0; i <= sample[0]; i++) used += sprintf(text + used, " %d", locations[i]); + line(text); +} + +static void metrics(void) +{ + static const char codes[] = { ' ', '.', 'A', 'B', 'W', 'a', 'f', 'g', 'i', 'j', 'Z', '~', '\r', '\t', 0 }; + static const short sizes[] = { 12, 24, 18, 9, 6, 36, 13, 0 }; + char label[80]; + int i, f; + + plain(); + number("GetFNum", family); + for (f = 0; f < FACES; f++) { + plain(); TextFace(faces[f].face); + sprintf(label, "GetFontInfo, %s", faces[f].name); info(label); + measures(faces[f].name); + sprintf(label, "CharWidth of A, %s", faces[f].name); number(label, CharWidth('A')); + sprintf(label, "CharWidth of space, %s", faces[f].name); number(label, CharWidth(' ')); + } + + plain(); + for (i = 0; i < (int)sizeof codes; i++) { + sprintf(label, "CharWidth %d", (unsigned char)codes[i]); + number(label, CharWidth((unsigned char)codes[i])); + } + number("CharWidth 200", CharWidth(200)); + number("TextWidth from 0 for 0", TextWidth((Ptr)(sample + 1), 0, 0)); + number("TextWidth from 2 for 4", TextWidth((Ptr)(sample + 1), 2, 4)); + + for (i = 0; i < (int)(sizeof sizes / sizeof sizes[0]); i++) { + plain(); TextSize(sizes[i]); + sprintf(label, "GetFontInfo at %d", sizes[i]); info(label); + sprintf(label, "at %d", sizes[i]); measures(label); + TextFace(1); + sprintf(label, "bold at %d", sizes[i]); measures(label); + } + + plain(); SpaceExtra(0x00028000); + number("StringWidth of one space, spExtra 2.5", StringWidth("\p ")); + number("StringWidth of two spaces, spExtra 2.5", StringWidth("\p ")); + number("StringWidth of three spaces, spExtra 2.5", StringWidth("\p ")); + measures("spExtra 2.5"); + plain(); SpaceExtra(0x00004000); + number("StringWidth of A space A space A, spExtra 0.25", StringWidth("\pA A A")); + number("StringWidth of five spaces, spExtra 0.25", StringWidth("\p ")); + plain(); SpaceExtra(-0x00018000); + number("StringWidth of three spaces, spExtra -1.5", StringWidth("\p ")); + plain(); CharExtra(0x00030000); + number("StringWidth with CharExtra 3 in a GrafPort", StringWidth(sample)); +} + +static void pen(void) +{ + plain(); DrawChar('A'); picture("DrawChar A"); + plain(); DrawChar('Z'); picture("DrawChar of a missing character"); + plain(); DrawString(sample); picture("DrawString"); + plain(); DrawString("\pBZ~a"); picture("DrawString with missing characters"); + plain(); DrawText((Ptr)(sample + 1), 2, 4); picture("DrawText from 2 for 4"); + plain(); DrawString("\p"); picture("DrawString of nothing"); + plain(); MoveTo(0, 16); DrawString("\pjfA"); picture("DrawString overhanging the left edge"); + plain(); MoveTo(90, 16); DrawString("\pAW"); picture("DrawString past the right edge"); +} + +static void styles(void) +{ + char label[80]; + int f; + for (f = 0; f < FACES; f++) { + plain(); TextFace(faces[f].face); DrawString(sample); + sprintf(label, "style %s", faces[f].name); picture(label); + plain(); TextFace(faces[f].face); DrawString(pair); + sprintf(label, "style %s, short", faces[f].name); picture(label); + } +} + +/* Vertical stripes four pixels wide, to see what a mode does over ink. */ +static void stripes(void) +{ + int row, i; + for (row = 0; row < 32; row++) + for (i = 0; i < ROW; i++) pixels[row * ROW + i] = 0xF0; +} + +static void modes(void) +{ + static const struct { const char *name; short mode; } list[] = { + { "srcCopy", srcCopy }, { "srcOr", srcOr }, { "srcXor", srcXor }, { "srcBic", srcBic }, + { "notSrcCopy", notSrcCopy }, { "notSrcOr", notSrcOr }, { "notSrcXor", notSrcXor }, { "notSrcBic", notSrcBic }, + }; + char label[80]; + int m; + for (m = 0; m < 8; m++) { + plain(); stripes(); TextMode(list[m].mode); DrawString(pair); + sprintf(label, "mode %s", list[m].name); picture(label); + plain(); stripes(); TextMode(list[m].mode); TextFace(4); DrawString(pair); + sprintf(label, "mode %s, underline", list[m].name); picture(label); + } + plain(); stripes(); TextMode(srcCopy); TextFace(2); DrawString(pair); picture("mode srcCopy, italic"); + plain(); stripes(); TextMode(srcCopy); TextFace(16); DrawString(pair); picture("mode srcCopy, shadow"); + plain(); stripes(); TextMode(srcXor); TextFace(8); DrawString(pair); picture("mode srcXor, outline"); +} + +static void state(void) +{ + plain(); ForeColor(whiteColor); stripes(); DrawString(pair); picture("fore color white"); + plain(); ForeColor(redColor); DrawString(pair); picture("fore color red"); + plain(); BackColor(blackColor); TextMode(srcCopy); DrawString(pair); picture("back color black, srcCopy"); + plain(); BackPat(&half); TextMode(srcCopy); DrawString(pair); picture("back pattern, srcCopy"); + plain(); PenPat(&half); PenMode(patXor); PenSize(3, 3); DrawString(pair); picture("pen pattern, mode and size"); + plain(); HidePen(); DrawString(pair); ShowPen(); picture("pen hidden"); + plain(); + { + Rect clip = { 10, 10, 18, 18 }; + ClipRect(&clip); + DrawString(sample); + } + picture("clipped"); + plain(); SetOrigin(4, 2); MoveTo(12, 18); DrawString(pair); picture("origin 4,2"); + plain(); SpaceExtra(0x00028000); DrawString("\pa a a"); picture("spExtra 2.5"); + plain(); SpaceExtra(0x00028000); TextFace(4); DrawString("\pa a a"); picture("spExtra 2.5, underline"); + plain(); SpaceExtra(0x00004000); DrawString("\p. . . . ."); picture("spExtra 0.25"); + plain(); TextFace(4); DrawString("\pA g j"); picture("underline over spaces and descenders"); + plain(); TextFace(4); DrawChar('g'); DrawChar('a'); picture("underline, two DrawChars"); + plain(); TextFace(2); DrawChar('A'); DrawChar('W'); picture("italic, two DrawChars"); + plain(); + { + RgnHandle rgn = NewRgn(); + OpenRgn(); + DrawString(pair); + CloseRgn(rgn); + number("size of the region of a DrawString", (**rgn).rgnSize); + picture("DrawString in an open region"); + DisposeRgn(rgn); + } +} + +static void scaled(void) +{ + static const short sizes[] = { 24, 18, 9, 6 }; + char label[80]; + int i; + for (i = 0; i < 4; i++) { + plain(); TextSize(sizes[i]); MoveTo(8, 22); DrawString(pair); + sprintf(label, "size %d", sizes[i]); picture(label); + plain(); TextSize(sizes[i]); TextFace(1); MoveTo(8, 22); DrawString(pair); + sprintf(label, "size %d, bold", sizes[i]); picture(label); + } +} + +int main(void) +{ + static const unsigned char name[] = "\pText.txt"; + + InitGraf(&qd.thePort); + InitFonts(); + if (Create(name, 0, 'Grph', 'TEXT') != noErr) return 1; + if (FSOpen(name, 0, &out) != noErr) return 2; + OpenPort(&port); + GetFNum("\pGraphiteProbe", &family); + + metrics(); + pen(); + styles(); + modes(); + state(); + scaled(); + + line("done"); + FSClose(out); + FlushVol(0, 0); + return 0; +} diff --git a/ReferenceTests/Retro68/TextCapture.r b/ReferenceTests/Retro68/TextCapture.r new file mode 100644 index 0000000..d4489f9 --- /dev/null +++ b/ReferenceTests/Retro68/TextCapture.r @@ -0,0 +1,57 @@ +/* + * TextCapture's own font, "GraphiteProbe", so that what it draws can be + * drawn again without any of Apple's fonts: a family record and a 12 point + * bitmap font of ascent 9, descent 3, leading 1 and maximum kerning + * -2, over characters 32 to 122. It has these, and a missing symbol (a box, + * offset 2, advance 6) for the rest: + * + * space: offset 2, advance 4 + * .: offset 3, advance 4 + * A: offset 3, advance 7 + * B: offset 3, advance 7 + * W: offset 2, advance 10 + * a: offset 3, advance 6 + * f: offset 3, advance 4 + * g: offset 3, advance 6 + * i: offset 3, advance 2 + * j: offset 0, advance 3 + */ +data 'FOND' (1500, "GraphiteProbe") { + $"000005DC0020007A0000000000000000" + $"00000000000000000000000000000000" + $"00000000000000000000000000000000" + $"000000000000000C000005DC" +}; + +data 'NFNT' (1500) { + $"90000020007A000AFFFEFFFD000B000C" + $"0086000900030001000309E8080E08FC" + $"15180810004423180810004423E88BBC" + $"F8C43F18885118C423194BD118C4231A" + $"2C5118C4E31C1C50F8C4E3E80BD018FC" + $"00000000108000000001148000000000" + $"E3000000000000000000000000000000" + $"00000000000000000000000000000000" + $"00020002000200020002000200020002" + $"00020002000200020002000200020002" + $"0002000200020007000C000C000C000C" + $"000C000C000C000C000C000C000C000C" + $"000C000C000C000C000C000C000C000C" + $"000C0015001500150015001500150015" + $"001500150015001A001A001A001A001A" + $"001F0024002400250029002900290029" + $"00290029002900290029002900290029" + $"00290029002900290029002E0204FFFF" + $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFF0304FFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFFFFFFFF0307" + $"0307FFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFF020AFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFFFFFFFF0306" + $"FFFFFFFFFFFFFFFF03040306FFFF0302" + $"0003FFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFF0206FFFF" +}; diff --git a/Sources/CMakeLists.txt b/Sources/CMakeLists.txt index 88f25ce..07c1dc4 100644 --- a/Sources/CMakeLists.txt +++ b/Sources/CMakeLists.txt @@ -72,5 +72,5 @@ endif() # QuickDraw's C API, for programs written in C. if(GRAPHITE_BUILD_QUICKDRAW) include(GraphiteQuickDrawLibrary) - graphite_add_quickdraw_library(Graphite2D) + graphite_add_quickdraw_library(GraphiteText) endif() diff --git a/Sources/CQuickDraw/stubs.c b/Sources/CQuickDraw/stubs.c index 8fcfe83..4653786 100644 --- a/Sources/CQuickDraw/stubs.c +++ b/Sources/CQuickDraw/stubs.c @@ -81,12 +81,6 @@ INTEGER * GetMaskTable(void) return none; } -void CharExtra(Fixed Extra) -{ - (void) Extra; - cquickdraw_unimplemented("CharExtra"); -} - void MakeRGBPat(PixPatHandle ph, RGBColor * colorp) { (void) ph; @@ -261,66 +255,6 @@ INTEGER StdTxMeas(INTEGER n, Ptr p, Point * nump, Point * denp, FontInfo * finfo return none; } -void MeasureText(INTEGER n, Ptr text, Ptr chars) -{ - (void) n; - (void) text; - (void) chars; - cquickdraw_unimplemented("MeasureText"); -} - -void DrawChar(CharParameter thec) -{ - (void) thec; - cquickdraw_unimplemented("DrawChar"); -} - -void DrawString(ConstStringPtr s) -{ - (void) s; - cquickdraw_unimplemented("DrawString"); -} - -void DrawText(Ptr tb, INTEGER fb, INTEGER bc) -{ - (void) tb; - (void) fb; - (void) bc; - cquickdraw_unimplemented("DrawText"); -} - -INTEGER CharWidth(CharParameter thec) -{ - (void) thec; - cquickdraw_unimplemented("CharWidth"); - static INTEGER none; - return none; -} - -INTEGER StringWidth(ConstStringPtr s) -{ - (void) s; - cquickdraw_unimplemented("StringWidth"); - static INTEGER none; - return none; -} - -INTEGER TextWidth(Ptr tb, INTEGER fb, INTEGER bc) -{ - (void) tb; - (void) fb; - (void) bc; - cquickdraw_unimplemented("TextWidth"); - static INTEGER none; - return none; -} - -void GetFontInfo(FontInfo * ip) -{ - (void) ip; - cquickdraw_unimplemented("GetFontInfo"); -} - void GetCPixel(INTEGER h, INTEGER v, RGBColor * colorp) { (void) h; diff --git a/Sources/GraphiteQuickDrawABI/PortStorage.swift b/Sources/GraphiteQuickDrawABI/PortStorage.swift index a9214ce..66d9ef7 100644 --- a/Sources/GraphiteQuickDrawABI/PortStorage.swift +++ b/Sources/GraphiteQuickDrawABI/PortStorage.swift @@ -103,6 +103,8 @@ func enginePort(_ record: CGrafPortRecord) -> Graphite2D.Port { port.pen = Graphite2D.PenState(location: GraphiteCore.Point(record.pnLoc), size: GraphiteCore.Point(record.pnSize), mode: TransferMode(rawValue: record.pnMode), pattern: Graphite2D.Pattern(record.pnPat), visibility: record.pnVis) + port.text = Graphite2D.TextSettings(font: record.txFont, face: record.txFace, size: record.txSize, + mode: TransferMode(rawValue: record.txMode), spaceExtra: Fixed(rawValue: record.spExtra)) // In a black and white port every color but white is black, as Mac OS // 9.2.2 copied them. port.foreColor = Int32(record.fgColor) == 30 ? .white : .black diff --git a/Sources/GraphiteQuickDrawABI/TextAPI.swift b/Sources/GraphiteQuickDrawABI/TextAPI.swift new file mode 100644 index 0000000..6a486b2 --- /dev/null +++ b/Sources/GraphiteQuickDrawABI/TextAPI.swift @@ -0,0 +1,105 @@ +// DrawChar, DrawString and DrawText at the pen of the current port, and the +// calls that measure them, over GraphiteText. +// +// There is no Font Manager here, so a program has no way to add a font: text +// is drawn in the built-in system font, whatever TextFont says, unless one is +// registered with `Fonts.registry`. + +import CQuickDraw +import GraphiteCore +import Graphite2D +import GraphiteText + +enum Fonts { + static let registry = FontRegistry() +} + +private func scalars(_ bytes: UnsafeBufferPointer) -> String.UnicodeScalarView { + MacRoman.decode(bytes).unicodeScalars +} + +/// A Pascal string's characters. +private func characters(_ string: UnsafePointer) -> String.UnicodeScalarView { + scalars(UnsafeBufferPointer(start: string + 1, count: Int(string.pointee))) +} + +/// `count` characters from `first` bytes into a buffer. +private func characters(_ text: UnsafeMutablePointer, _ first: Int16, _ count: Int16) -> String.UnicodeScalarView { + let start = UnsafeRawPointer(text).assumingMemoryBound(to: UInt8.self) + Int(first) + return scalars(UnsafeBufferPointer(start: start, count: max(0, Int(count)))) +} + +private func draw(_ characters: String.UnicodeScalarView) { + drawing { $0.drawText(characters, fonts: Fonts.registry) } +} + +private func width(_ characters: String.UnicodeScalarView) -> Int16 { + guard let record = currentPort() else { return 0 } + return Int16(clamping: enginePort(record.pointee).textWidth(characters, fonts: Fonts.registry)) +} + +private func character(_ code: Int16) -> String.UnicodeScalarView { + withUnsafeBytes(of: UInt8(truncatingIfNeeded: code)) { scalars($0.bindMemory(to: UInt8.self)) } +} + +@c @implementation +public func DrawChar(_ thec: Int16) { + draw(character(thec)) +} + +@c @implementation +public func DrawString(_ s: UnsafePointer?) { + guard let s else { return fail() } + draw(characters(s)) +} + +@c @implementation +public func DrawText(_ tb: UnsafeMutablePointer?, _ fb: Int16, _ bc: Int16) { + guard let tb else { return fail() } + draw(characters(tb, fb, bc)) +} + +@c @implementation +public func CharWidth(_ thec: Int16) -> Int16 { + width(character(thec)) +} + +@c @implementation +public func StringWidth(_ s: UnsafePointer?) -> Int16 { + guard let s else { + fail() + return 0 + } + return width(characters(s)) +} + +@c @implementation +public func TextWidth(_ tb: UnsafeMutablePointer?, _ fb: Int16, _ bc: Int16) -> Int16 { + guard let tb else { + fail() + return 0 + } + return width(characters(tb, fb, bc)) +} + +@c @implementation +public func MeasureText(_ n: Int16, _ text: UnsafeMutablePointer?, _ chars: UnsafeMutablePointer?) { + guard let text, let chars, let record = currentPort() else { return fail() } + let positions = enginePort(record.pointee).measureText(characters(text, 0, n), fonts: Fonts.registry) + for (index, position) in positions.enumerated() { + UnsafeMutableRawPointer(chars).storeBytes(of: Int16(clamping: position), toByteOffset: index * 2, as: Int16.self) + } +} + +@c @implementation +public func GetFontInfo(_ ip: UnsafeMutablePointer?) { + guard let ip, let record = currentPort() else { return fail() } + let metrics = enginePort(record.pointee).fontInfo(fonts: Fonts.registry) + ip.pointee = CQuickDraw.FontInfo(ascent: metrics.ascent, descent: metrics.descent, widMax: metrics.widMax, leading: metrics.leading) +} + +/// A black and white port has nowhere to keep it. +@c @implementation +public func CharExtra(_ Extra: Int32) { + _ = currentPort() +} diff --git a/Sources/GraphiteText/BitmapFont.swift b/Sources/GraphiteText/BitmapFont.swift new file mode 100644 index 0000000..2da07e9 --- /dev/null +++ b/Sources/GraphiteText/BitmapFont.swift @@ -0,0 +1,104 @@ +// A Macintosh bitmap font: an 'NFNT' or 'FONT' resource, one size's strike +// of 1 bit glyphs, indexed by MacRoman byte. A character it hasn't is drawn +// as its missing symbol. + +import GraphiteCore + +public final class BitmapFont: FontFace { + + public let familyName: String + /// The size the strike was drawn for; others are stretched from it. + public let size: Int + + private let firstCharacter: Int + private let lastCharacter: Int + private let widestWidth: Int + private let maximumKern: Int + private let height: Int + private let ascent: Int + private let descent: Int + private let leading: Int + private let rowBytes: Int + private let image: [UInt8] + /// Where each glyph starts in the strike, in bits: one a character, the + /// missing symbol, and the end of it. + private let locations: [Int] + /// Each glyph's offset and width; 0xFFFF for one that is missing. + private let widths: [Int] + + /// The font in a resource's bytes; nil if they aren't a 1 bit font. + public init?(familyName: String, size: Int, resource data: [UInt8]) { + func word(_ offset: Int) -> Int? { + guard offset >= 0, offset + 1 < data.count else { return nil } + return Int(data[offset]) << 8 | Int(data[offset + 1]) + } + func signed(_ offset: Int) -> Int? { + word(offset).map { Int(Int16(bitPattern: UInt16($0))) } + } + guard size > 0, let type = word(0), type & 0x000C == 0, + let first = word(2), let last = word(4), first <= last, last <= 255, + let widest = signed(6), let kern = signed(8), let height = word(14), let tableWords = word(16), + let ascent = signed(18), let descent = signed(20), let leading = signed(22), let rowWords = word(24) + else { return nil } + let rowBytes = rowWords * 2 + let imageEnd = 26 + rowBytes * height + // A location and a width for every character, the missing symbol, + // and one more. + let count = last - first + 3 + let widthTable = 16 + tableWords * 2 + guard imageEnd + count * 2 <= data.count, widthTable + count * 2 <= data.count else { return nil } + let locations = (0 ..< count).compactMap { word(imageEnd + $0 * 2) } + let widths = (0 ..< count).compactMap { word(widthTable + $0 * 2) } + guard locations.count == count, widths.count == count, + zip(locations, locations.dropFirst()).dropLast().allSatisfy({ $0 <= $1 && $1 <= rowBytes * 8 }) + else { return nil } + self.familyName = familyName + self.size = size + self.firstCharacter = first + self.lastCharacter = last + self.widestWidth = widest + self.maximumKern = kern + self.height = height + self.ascent = ascent + self.descent = descent + self.leading = leading + self.rowBytes = rowBytes + self.image = Array(data[26 ..< imageEnd]) + self.locations = locations + self.widths = widths + } + + public var strikeSize: Int? { size } + + public var kerning: Int { maximumKern } + + public func metrics(size: Int) -> FontMetrics { + let size = size <= 0 ? 12 : size + func scaled(_ value: Int) -> Int16 { Int16(clamping: (value * size + self.size / 2) / self.size) } + return FontMetrics(ascent: scaled(ascent), descent: scaled(descent), widMax: scaled(widestWidth), leading: scaled(leading)) + } + + public func glyph(for character: Unicode.Scalar, size: Int) -> GlyphImage? { + let size = size <= 0 ? 12 : size + let code = MacRoman.byte(Character(character)).map(Int.init) + var index = lastCharacter - firstCharacter + 1 + if let code, code >= firstCharacter, code <= lastCharacter, widths[code - firstCharacter] != 0xFFFF { + index = code - firstCharacter + } + guard widths[index] != 0xFFFF else { return .blank(advance: 0) } + let offset = widths[index] >> 8, advance = widths[index] & 0xFF + let start = locations[index], width = max(0, locations[index + 1] - start) + func scaled(_ value: Int) -> Int { value * size / self.size } + let columns = scaled(width), rows = scaled(height) + var coverage = [UInt8](repeating: 0, count: columns * rows) + for row in 0 ..< rows { + for column in 0 ..< columns { + let bit = start + column * self.size / size + let byte = image[(row * self.size / size) * rowBytes + bit / 8] + if byte & (0x80 >> (bit % 8)) != 0 { coverage[row * columns + column] = 255 } + } + } + return GlyphImage(width: columns, height: rows, left: scaled(maximumKern + offset), top: scaled(ascent), + coverage: coverage, advance: scaled(advance)) + } +} diff --git a/Sources/GraphiteText/FontFace.swift b/Sources/GraphiteText/FontFace.swift index aa6369a..a635fa3 100644 --- a/Sources/GraphiteText/FontFace.swift +++ b/Sources/GraphiteText/FontFace.swift @@ -83,6 +83,14 @@ public protocol FontFace: AnyObject, Sendable { /// from its plain glyphs. func hasStyle(_ style: TextStyle) -> Bool + /// The one size a bitmap face's glyphs are drawn for, which QuickDraw + /// stretches to others; nil for a face that draws any size itself. + var strikeSize: Int? { get } + + /// How far left of the pen the face's glyphs reach at its strike's size: + /// 0 or less. + var kerning: Int { get } + func metrics(size: Int) -> FontMetrics /// A character's image; nil for one the face hasn't. @@ -108,6 +116,8 @@ public protocol FontFace: AnyObject, Sendable { public extension FontFace { func hasStyle(_ style: TextStyle) -> Bool { style.isEmpty } + var strikeSize: Int? { nil } + var kerning: Int { 0 } func table(_ tag: FourCharCode) -> [UInt8]? { nil } var horizontalMetrics: HorizontalFontMetrics? { nil } diff --git a/Sources/GraphiteText/QuickDrawText.swift b/Sources/GraphiteText/QuickDrawText.swift index 90528c0..c82bb1d 100644 --- a/Sources/GraphiteText/QuickDrawText.swift +++ b/Sources/GraphiteText/QuickDrawText.swift @@ -1,9 +1,15 @@ // QuickDraw's text: DrawString, DrawText and DrawChar at the pen in the -// port's font, face, size and mode, and TextWidth, StringWidth, CharWidth -// and GetFontInfo. Styles a face hasn't are drawn from its plain glyphs as -// QuickDraw drew them: bold twice a pixel apart and a pixel wider, italic -// slanted a pixel in four, underline below the baseline, outline and shadow -// around the glyph, condense and extend a pixel narrower and wider. +// port's font, face, size and mode, and TextWidth, StringWidth, CharWidth, +// MeasureText and GetFontInfo, as Mac OS 9.2.2 gave and drew them +// (ReferenceTests/Retro68/Text-macos-9.2.2-ppc.txt). +// +// The characters are drawn into a strip of their own at the face's size, +// styled there, stretched if the face has only another size, and then put on +// the port in the text mode. Styles a face hasn't are drawn from its plain +// glyphs: bold twice a pixel apart and a pixel wider; italic a pixel to the +// right for every two above the baseline; underline below the baseline, +// broken around descenders; outline and shadow around the glyphs; condense +// and extend a pixel narrower and wider. import GraphiteCore import Graphite2D @@ -13,22 +19,30 @@ public extension Port { /// GetFontInfo for the port's font, size and face. func fontInfo(fonts: FontRegistry) -> FontMetrics { let style = TextStyle(rawValue: text.face) - var metrics = fonts.face(family: text.font, style: style).metrics(size: Int(text.size)) - if style.contains(.italic) { metrics.widMax += metrics.ascent / 4 } - if style.contains(.shadow) { - metrics.descent += 1 - metrics.widMax += 2 - } else if style.contains(.outline) { - metrics.widMax += 1 + let face = fonts.face(family: text.font, style: style) + let size = requestedSize + let native = face.strikeSize ?? size + var metrics = face.metrics(size: native) + let synthesized = synthesizedStyle(for: face) + if synthesized.contains(.bold) { metrics.widMax += 1 } + if synthesized.contains(.condense) { metrics.widMax -= 1 } + if synthesized.contains(.extend) { metrics.widMax += 1 } + let around = Int16(surround(synthesized)) + if around > 0 { + metrics.ascent += 1 + metrics.descent += around + metrics.widMax += around } - return metrics + func scaled(_ value: Int16) -> Int16 { Int16(clamping: (Int(value) * size + native / 2) / native) } + return FontMetrics(ascent: scaled(metrics.ascent), descent: scaled(metrics.descent), + widMax: scaled(metrics.widMax), leading: scaled(metrics.leading)) } - /// TextWidth and StringWidth: how far drawing the characters moves the - /// pen, in whole pixels. + /// TextWidth, StringWidth and CharWidth: how far drawing the characters + /// moves the pen, in whole pixels. func textWidth(_ characters: some Sequence, fonts: FontRegistry) -> Int { let layout = layOut(characters, fonts: fonts) - return Int(layout.width.rounded()) + return Int(layout.scaled(layout.width).rounded(.down)) } /// TextWidth of MacRoman text, as programs pass it. @@ -36,42 +50,22 @@ public extension Port { textWidth(MacRoman.decode(bytes).unicodeScalars, fonts: fonts) } + /// MeasureText: where each character starts from the pen, and where the + /// last ends. + func measureText(_ characters: some Sequence, fonts: FontRegistry) -> [Int] { + let layout = layOut(characters, fonts: fonts) + return (layout.glyphs.map(\.x) + [layout.width]).map { Int(layout.scaled($0).rounded(.down)) } + } + /// DrawText, DrawString and DrawChar: the characters at the pen, which - /// moves past them. + /// moves past them. A hidden pen draws nothing. func drawText(_ characters: some Sequence, fonts: FontRegistry) { let layout = layOut(characters, fonts: fonts) let origin = pen.location - defer { pen.location.h &+= Int16(clamping: Int(layout.width.rounded())) } - guard let pixels else { return } - let style = layout.style - let drawable = drawableRegion - // srcCopy draws the characters' cell in the background color first. - if text.mode.base == .srcCopy || text.mode.base == .notSrcCopy { - let metrics = layout.face.metrics(size: Int(text.size)) - let cell = Rect(top: origin.v &- metrics.ascent, left: origin.h, bottom: origin.v &+ metrics.descent, - right: origin.h &+ Int16(clamping: Int(layout.width.rounded()))) - draw(Region(rect: cell), pattern: .white, mode: .patCopy) - } - for placed in layout.glyphs { - var mask = Mask(placed.glyph, synthesizing: style) - if style.contains(.outline) || style.contains(.shadow) { mask = mask.outlined(shadow: style.contains(.shadow)) } - let left = Int(origin.h) + Int(placed.x.rounded()) + mask.left - let top = Int(origin.v) - mask.top - for row in 0 ..< mask.height { - for column in 0 ..< mask.width { - let coverage = mask.coverage[row * mask.width + column] - guard coverage > 0 else { continue } - let point = Point(v: Int16(clamping: top + row), h: Int16(clamping: left + column)) - guard drawable.contains(point) else { continue } - plot(coverage, at: point, in: pixels) - } - } - } - if style.contains(.underline) { - let y = origin.v &+ 1 - let line = Rect(top: y, left: origin.h, bottom: y &+ 1, right: origin.h &+ Int16(clamping: Int(layout.width.rounded()))) - for point in Region(rect: line).intersection(drawable).rectangles.flatMap(points) { plot(255, at: point, in: pixels) } - } + defer { pen.location.h &+= Int16(clamping: Int((layout.scaled(layout.width) + 0.5).rounded(.down))) } + guard let pixels, pen.visibility >= 0, !layout.glyphs.isEmpty else { return } + let (strip, cell) = render(layout) + put(strip, cell: cell, outlined: surround(layout.style) > 0, at: origin, in: pixels) } /// DrawString of MacRoman bytes, a Pascal string's. @@ -83,47 +77,217 @@ public extension Port { private struct Placed { var glyph: GlyphImage + /// From the pen, in the strike's pixels. var x: Double } private struct Layout { var face: any FontFace + /// The styles the face leaves to be drawn from its glyphs. var style: TextStyle var glyphs: [Placed] var width: Double + /// The size asked for, and the size the glyphs are drawn at. + var size: Int + var native: Int + + /// By the sizes' ratio in 16.16 fixed point, cut short as the Mac + /// had it. + func scaled(_ value: Double) -> Double { value * Double((size << 16) / native) / 65536 } + + /// A position in the strike as a whole pixel. + func column(_ x: Double) -> Int { Int((x + 0.5).rounded(.down)) } + } + + /// TextSize 0 is 12 points. + private var requestedSize: Int { text.size <= 0 ? 12 : Int(text.size) } + + private func synthesizedStyle(for face: any FontFace) -> TextStyle { + let style = TextStyle(rawValue: text.face) + return TextStyle(rawValue: style.rawValue & ~(face.hasStyle(style) ? style.rawValue : 0)) + } + + /// How far outline and shadow reach below and right of a glyph. + private func surround(_ style: TextStyle) -> Int { + (style.contains(.outline) ? 1 : 0) + (style.contains(.shadow) ? 2 : 0) } /// Where each character goes from the pen: its advance, the style's - /// extra, CharExtra for every one and SpaceExtra for spaces. + /// extra, CharExtra for every one and SpaceExtra for spaces. A carriage + /// return takes no room. private func layOut(_ characters: some Sequence, fonts: FontRegistry) -> Layout { - let style = TextStyle(rawValue: text.face) - let face = fonts.face(family: text.font, style: style) - let synthesized = TextStyle(rawValue: style.rawValue & ~(face.hasStyle(style) ? style.rawValue : 0)) - var extra = 0.0 - if synthesized.contains(.bold) { extra += 1 } - if synthesized.contains(.condense) { extra -= 1 } - if synthesized.contains(.extend) { extra += 1 } - if synthesized.contains(.shadow) { extra += 2 } else if synthesized.contains(.outline) { extra += 1 } - let characterExtra = Double(text.characterExtra.rawValue) / 65536 - let spaceExtra = Double(text.spaceExtra.rawValue) / 65536 + let face = fonts.face(family: text.font, style: TextStyle(rawValue: text.face)) + let style = synthesizedStyle(for: face) + let size = requestedSize + let native = face.strikeSize ?? size + var extra = surround(style) + if style.contains(.bold) { extra += 1 } + if style.contains(.condense) { extra -= 1 } + if style.contains(.extend) { extra += 1 } + // CharExtra and SpaceExtra are in the port's pixels. + let toNative = Double(native) / Double(size) + let characterExtra = Double(text.characterExtra.rawValue) / 65536 * toNative + let spaceExtra = Double(text.spaceExtra.rawValue) / 65536 * toNative var x = 0.0 var glyphs: [Placed] = [] for character in characters { - guard let glyph = face.glyph(for: character, size: Int(text.size)) ?? SystemFont.shared.glyph(for: character, size: Int(text.size)) else { continue } + if character == "\r" { + glyphs.append(Placed(glyph: .blank(advance: 0), x: x)) + continue + } + guard let glyph = face.glyph(for: character, size: native) ?? SystemFont.shared.glyph(for: character, size: native) else { continue } glyphs.append(Placed(glyph: glyph, x: x)) - x += Double(glyph.advance) + extra + characterExtra + (character == " " ? spaceExtra : 0) + x += Double(glyph.advance + extra) + characterExtra + (character == " " ? spaceExtra : 0) } - return Layout(face: face, style: synthesized, glyphs: glyphs, width: max(0, x)) + return Layout(face: face, style: style, glyphs: glyphs, width: max(0, x), size: size, native: native) + } + + // MARK: Rendering + + /// The characters styled and at the size asked for, around a pen at + /// (0, 0), and the cell that is theirs. + private func render(_ layout: Layout) -> (Strip, GraphiteCore.Rect) { + let style = layout.style + let metrics = layout.face.metrics(size: layout.native) + let ascent = Int(metrics.ascent), descent = Int(metrics.descent) + let around = surround(style) + let end = layout.column(layout.width) + + // The right edge: past the advance as far as the last glyph reaches. + let last = layout.glyphs[layout.glyphs.count - 1] + var image = max(end, layout.column(last.x) + last.glyph.left + last.glyph.inkWidth) + if style.contains(.underline), around > 0 { + image = end - around + } else if style.contains(.italic) { + image += (ascent >> 1) - (style.contains(.bold) ? 1 : 0) - around + } else if style.contains(.extend), !style.contains(.condense) { + image -= 1 + } + let right = image + + var left = min(layout.face.kerning, 0), width = right, top = -ascent, bottom = descent + for placed in layout.glyphs { + let x = layout.column(placed.x) + placed.glyph.left + left = min(left, x) + width = max(width, x + placed.glyph.width) + top = min(top, -placed.glyph.top) + bottom = max(bottom, placed.glyph.height - placed.glyph.top) + } + // Room for the slant, and for what is drawn around. + var strip = Strip(left: left - ascent - 4, top: top - 2, right: width + ascent + 8, bottom: bottom + 5) + for placed in layout.glyphs { + let glyph = placed.glyph + for row in 0 ..< glyph.height { + for column in 0 ..< glyph.width { + strip.cover(layout.column(placed.x) + glyph.left + column, row - glyph.top, glyph.coverage(column: column, row: row)) + } + } + } + + if style.contains(.bold) { + let plain = strip + plain.forEach { x, y, coverage in strip.cover(x + 1, y, coverage) } + } + // The columns an underline leaves out: those beside a descender, + // before the slant and after it. + var descenders: Set = [] + func findDescenders() { + strip.forEach { x, y, coverage in + guard (1 ... 2).contains(y), coverage >= 128 else { return } + descenders.formUnion(x - 1 ... x + 1) + } + } + findDescenders() + if style.contains(.italic) { + let upright = strip + strip.clear() + upright.forEach { x, y, coverage in strip.cover(x + ((-y) >> 1), y, coverage) } + findDescenders() + } + if style.contains(.underline) { + let start = around > 0 ? -1 : 0 + for x in start ..< max(start, right + around) where !descenders.contains(x) { strip.cover(x, 1, 255) } + } + if around > 0 { + let solid = strip + strip.clear() + solid.forEach { x, y, coverage in + guard coverage >= 128 else { return } + for dy in -1 ... around { + for dx in -1 ... around { strip.cover(x + dx, y + dy, 255) } + } + } + solid.forEach { x, y, coverage in + if coverage >= 128 { strip.hollow(x, y) } + } + } + strip.clip(left: around > 0 ? -1 : strip.left, right: right) + + var cell = GraphiteCore.Rect(top: Int16(clamping: -ascent), left: 0, bottom: Int16(clamping: descent), + right: Int16(clamping: max(right, end))) + guard layout.size != layout.native else { return (strip, cell) } + + // Stretched as CopyBits stretches a bitmap, from the font's kerning, + // by the sizes' ratio. + let size = layout.size, native = layout.native + func scaled(_ value: Int) -> Int { (value * size + (value < 0 ? -1 : 1) * (native / 2)) / native } + let sourceTop = -ascent - (around > 0 ? 1 : 0), sourceBottom = descent + (around > 0 ? 3 : 0) + let sourceLeft = min(layout.face.kerning, strip.inkLeft ?? 0) + let sourceWidth = (max(1, right - sourceLeft) + 2 * native - 1) / native * native + let from = GraphiteCore.Rect(top: Int16(clamping: sourceTop), left: Int16(clamping: sourceLeft), + bottom: Int16(clamping: sourceBottom), right: Int16(clamping: sourceLeft + sourceWidth)) + let toLeft = sourceLeft * size / native + let to = GraphiteCore.Rect(top: Int16(clamping: scaled(sourceTop)), left: Int16(clamping: toLeft), + bottom: Int16(clamping: scaled(sourceBottom)), + right: Int16(clamping: toLeft + sourceWidth * size / native)) + cell.top = Int16(clamping: scaled(-ascent)) + cell.bottom = Int16(clamping: scaled(descent)) + cell.right = Int16(clamping: Int((layout.scaled(Double(cell.right)) + 0.5).rounded(.down))) + return (strip.stretched(from: from, to: to), cell) } // MARK: Pixels - /// A glyph's coverage drawn in the text mode: on direct pixels in srcOr, - /// blended by its coverage; otherwise solid where it is half covered. - private func plot(_ coverage: UInt8, at point: Point, in pixels: PixelBuffer) { - guard let existing = pixels.color(at: point) else { return } + /// The strip on the port in the text mode. The modes that copy draw the + /// whole cell; outline and shadow are drawn over what is there, and clear + /// the glyphs they surround. + private func put(_ strip: Strip, cell: GraphiteCore.Rect, outlined: Bool, at origin: Point, in pixels: PixelBuffer) { + let drawable = drawableRegion let mode = text.mode.base - if !pixels.format.isIndexed, mode == .srcOr || mode == .srcCopy || mode == .grayishTextOr { + let inverted = mode.rawValue >= TransferMode.notSrcCopy.rawValue && mode.rawValue <= TransferMode.notSrcBic.rawValue + let outside: TransferMode = mode == .srcCopy ? .srcOr : mode + let bounds = GraphiteCore.Rect(top: min(cell.top, Int16(clamping: strip.top)), left: min(cell.left, Int16(clamping: strip.left)), + bottom: max(cell.bottom, Int16(clamping: strip.bottom)), right: max(cell.right, Int16(clamping: strip.right))) + for y in bounds.top ..< bounds.bottom { + for x in bounds.left ..< bounds.right { + let point = Point(v: origin.v &+ y, h: origin.h &+ x) + guard drawable.contains(point), let existing = pixels.color(at: point) else { continue } + let coverage = strip.coverage(Int(x), Int(y)) + if outlined { + if coverage >= 128 { + plot(coverage, existing: existing, mode: mode == .srcXor ? .srcOr : outside, at: point, in: pixels) + } else if strip.isHollow(Int(x), Int(y)), mode == .srcOr || mode == .srcCopy || mode == .srcXor { + pixels.setColor(backColor, at: point) + } + } else if cell.contains(Point(v: y, h: x)), mode == .srcCopy || inverted { + let isForeground = coverage >= 128 + let drawn = mode.booleanOperation != nil || isForeground ? foreColor : backColor + pixels.setColor(text.mode.combine(isForeground: isForeground, drawn: drawn, existing: existing, + fore: foreColor, back: backColor, opColor: opColor), at: point) + if mode == .srcCopy, coverage > 0, coverage < 255, !pixels.format.isIndexed { + plot(coverage, existing: backColor, mode: .srcOr, at: point, in: pixels) + } + } else if !inverted, coverage > 0 { + plot(coverage, existing: existing, mode: outside, at: point, in: pixels) + } + } + } + } + + /// A glyph pixel: on direct pixels in srcOr, blended by its coverage; + /// otherwise solid where it is half covered. + private func plot(_ coverage: UInt8, existing: RGBColor, mode: TransferMode, at point: Point, in pixels: PixelBuffer) { + if !pixels.format.isIndexed, mode == .srcOr || mode == .grayishTextOr { let weight = UInt32(coverage) func mix(_ a: UInt16, _ b: UInt16) -> UInt16 { UInt16((UInt32(a) * weight + UInt32(b) * (255 - weight)) / 255) } pixels.setColor(RGBColor(red: mix(foreColor.red, existing.red), green: mix(foreColor.green, existing.green), @@ -131,73 +295,110 @@ public extension Port { return } guard coverage >= 128 else { return } - let color = text.mode.combine(isForeground: true, drawn: foreColor, existing: existing, fore: foreColor, back: backColor, opColor: opColor) + let color = mode.combine(isForeground: true, drawn: foreColor, existing: existing, fore: foreColor, back: backColor, opColor: opColor) pixels.setColor(color, at: point) } +} + +/// Coverage around a pen at (0, 0), and the glyph pixels that outline and +/// shadow leave hollow. +private struct Strip { + let left: Int + let top: Int + let right: Int + let bottom: Int + private var values: [UInt8] + private var hollows: [Bool] - private func points(_ rect: Rect) -> [Point] { - (rect.top ..< rect.bottom).flatMap { v in (rect.left ..< rect.right).map { Point(v: v, h: $0) } } + init(left: Int, top: Int, right: Int, bottom: Int) { + self.left = left + self.top = top + self.right = max(left, right) + self.bottom = max(top, bottom) + values = [UInt8](repeating: 0, count: (self.right - left) * (self.bottom - top)) + hollows = [Bool](repeating: false, count: values.count) } -} -/// A glyph's coverage with the styles drawn from it. -private struct Mask { - var width: Int - var height: Int - var left: Int - var top: Int - var coverage: [UInt8] - - init(_ glyph: GlyphImage, synthesizing style: TextStyle) { - let slant = style.contains(.italic) ? (glyph.top + 3) / 4 : 0 - let bold = style.contains(.bold) ? 1 : 0 - width = glyph.width + slant + bold - height = glyph.height - left = glyph.left - top = glyph.top - coverage = [UInt8](repeating: 0, count: max(0, width * height)) - for row in 0 ..< glyph.height { - // Italic: a pixel to the right for every four above the baseline. - let shift = style.contains(.italic) ? max(0, (glyph.top - row) / 4) : 0 - for column in 0 ..< glyph.width { - let value = glyph.coverage(column: column, row: row) - guard value > 0 else { continue } - for offset in 0 ... bold { - let index = row * width + column + shift + offset - coverage[index] = max(coverage[index], value) - } + private func index(_ x: Int, _ y: Int) -> Int? { + guard x >= left, x < right, y >= top, y < bottom else { return nil } + return (y - top) * (right - left) + (x - left) + } + + func coverage(_ x: Int, _ y: Int) -> UInt8 { index(x, y).map { values[$0] } ?? 0 } + + func isHollow(_ x: Int, _ y: Int) -> Bool { index(x, y).map { hollows[$0] } ?? false } + + mutating func cover(_ x: Int, _ y: Int, _ coverage: UInt8) { + guard let index = index(x, y) else { return } + values[index] = max(values[index], coverage) + } + + mutating func hollow(_ x: Int, _ y: Int) { + guard let index = index(x, y) else { return } + values[index] = 0 + hollows[index] = true + } + + mutating func clear() { + values = [UInt8](repeating: 0, count: values.count) + } + + /// Keeps the columns from `left` up to `right`. + mutating func clip(left: Int, right: Int) { + for y in top ..< bottom { + for x in self.left ..< self.right where x < left || x >= right { + guard let index = index(x, y) else { continue } + values[index] = 0 + hollows[index] = false } } } - /// The pixels around the glyph and not in it, and for shadow those a - /// pixel below and right as well. - func outlined(shadow: Bool) -> Mask { - let grow = shadow ? 2 : 1 - var result = Mask(width: width + 2 * grow, height: height + 2 * grow, left: left - grow, top: top + grow, - coverage: [UInt8](repeating: 0, count: (width + 2 * grow) * (height + 2 * grow))) - func covered(_ column: Int, _ row: Int) -> Bool { - column >= 0 && row >= 0 && column < width && row < height && coverage[row * width + column] >= 128 + /// Every covered pixel. + func forEach(_ body: (Int, Int, UInt8) -> Void) { + for y in top ..< bottom { + for x in left ..< right where coverage(x, y) > 0 { body(x, y, coverage(x, y)) } } - for row in 0 ..< result.height { - for column in 0 ..< result.width { - let x = column - grow, y = row - grow - guard !covered(x, y) else { continue } - var near = false - for dy in -1 ... (shadow ? 2 : 1) { - for dx in -1 ... (shadow ? 2 : 1) where covered(x - dx, y - dy) { near = true } + } + + /// The leftmost column covered or hollow. + var inkLeft: Int? { + (left ..< right).first { x in (top ..< bottom).contains { coverage(x, $0) > 0 || isHollow(x, $0) } } + } + + /// The pixels in `from` stretched over `to`, as CopyBits does a bitmap. + func stretched(from: GraphiteCore.Rect, to: GraphiteCore.Rect) -> Strip { + func bitmap(_ bounds: GraphiteCore.Rect, _ isSet: (Int, Int) -> Bool) -> PixelBuffer { + let buffer = PixelBuffer(bounds: bounds, format: .indexed(depth: 1)) + for v in bounds.top ..< bounds.bottom { + for h in bounds.left ..< bounds.right { + buffer.setValue(isSet(Int(h), Int(v)) ? 1 : 0, at: Point(v: v, h: h)) } - if near { result.coverage[row * result.width + column] = 255 } + } + return buffer + } + func copy(_ isSet: (Int, Int) -> Bool) -> PixelBuffer { + let result = bitmap(to) { _, _ in false } + Port(pixels: result).copyBits(from: bitmap(from, isSet), sourceRect: from, destinationRect: to) + return result + } + let ink = copy { coverage($0, $1) >= 128 } + let inside = copy { isHollow($0, $1) } + var result = Strip(left: Int(to.left), top: Int(to.top), right: Int(to.right), bottom: Int(to.bottom)) + for v in to.top ..< to.bottom { + for h in to.left ..< to.right { + if ink.value(at: Point(v: v, h: h)) == 1 { result.cover(Int(h), Int(v), 255) } + if inside.value(at: Point(v: v, h: h)) == 1 { result.hollow(Int(h), Int(v)) } } } return result } +} - private init(width: Int, height: Int, left: Int, top: Int, coverage: [UInt8]) { - self.width = width - self.height = height - self.left = left - self.top = top - self.coverage = coverage +private extension GlyphImage { + + /// How many columns of the image reach its rightmost ink. + var inkWidth: Int { + (0 ..< width).last { column in (0 ..< height).contains { coverage(column: column, row: $0) > 0 } }.map { $0 + 1 } ?? 0 } } diff --git a/Sources/GraphiteText/SystemFont.swift b/Sources/GraphiteText/SystemFont.swift index b1dfdba..efd0891 100644 --- a/Sources/GraphiteText/SystemFont.swift +++ b/Sources/GraphiteText/SystemFont.swift @@ -15,6 +15,10 @@ public final class SystemFont: FontFace { /// Its size, whatever is asked for 0. public static var nativeSize: Int { 12 } + public var strikeSize: Int? { Self.nativeSize } + + public var kerning: Int { -SystemFontGlyphs.leftMargin } + private func scale(_ size: Int) -> (numerator: Int, denominator: Int) { let size = size <= 0 ? Self.nativeSize : size return (size, Self.nativeSize) diff --git a/Tests/GraphiteQuickDrawABITests/TextCaptureTests.swift b/Tests/GraphiteQuickDrawABITests/TextCaptureTests.swift new file mode 100644 index 0000000..bbce583 --- /dev/null +++ b/Tests/GraphiteQuickDrawABITests/TextCaptureTests.swift @@ -0,0 +1,272 @@ +import Testing +import Foundation +import CQuickDraw +import GraphiteCore +import GraphiteText +@testable import GraphiteQuickDrawABI + +private typealias CPattern = CQuickDraw.Pattern +private typealias CRect = CQuickDraw.Rect + +private let retro68 = URL(fileURLWithPath: #filePath).deletingLastPathComponent() + .deletingLastPathComponent().deletingLastPathComponent().appendingPathComponent("ReferenceTests/Retro68") + +/// The 'NFNT' in the probe's resource source, as Rez reads it. +private let probeFont: BitmapFont = { + let source = String(decoding: try! Data(contentsOf: retro68.appendingPathComponent("TextCapture.r")), as: UTF8.self) + let resource = source[source.range(of: "data 'NFNT'")!.upperBound...] + var bytes: [UInt8] = [] + for line in resource.split(separator: "\n") { + guard let open = line.range(of: "$\"") else { continue } + let hex = Array(line[open.upperBound...].prefix { $0 != "\"" }) + for i in stride(from: 0, to: hex.count, by: 2) { bytes.append(UInt8(String(hex[i ... i + 1]), radix: 16)!) } + } + return BitmapFont(familyName: "GraphiteProbe", size: 12, resource: bytes)! +}() + +private let family: Int16 = 1500 +private let row = 12 + +private let faces: [(String, Int16)] = [ + ("plain", 0), ("bold", 1), ("italic", 2), ("underline", 4), + ("outline", 8), ("shadow", 16), ("condense", 32), ("extend", 64), + ("bold italic", 3), ("bold underline", 5), ("bold outline", 9), + ("outline shadow", 24), ("italic shadow", 18), ("italic underline", 6), + ("underline shadow", 20), ("bold condense", 33), ("condense extend", 96), + ("all", 127), +] + +/// A Pascal string of MacRoman characters. +private func pascal(_ text: String, _ body: (UnsafeMutablePointer) -> Result) -> Result { + var bytes = [UInt8(text.utf8.count)] + Array(text.utf8) + return bytes.withUnsafeMutableBufferPointer { body($0.baseAddress!) } +} + +private let sample = "Afgj Wai." +private let pair = "gaf" + +/// TextCapture.c's calls, made through the C API: a port over a 96 by 32 +/// bitmap, and the lines the probe wrote. +private final class Probe { + let port = UnsafeMutablePointer.allocate(capacity: 1) + let pixels = UnsafeMutablePointer.allocate(capacity: row * 32) + var lines: [String] = [] + + init() { + Fonts.registry.register(probeFont, number: family) + port.initialize(to: GrafPort()) + pixels.initialize(repeating: 0, count: row * 32) + OpenPort(port) + } + + deinit { + ClosePort(port) + port.deallocate() + pixels.deallocate() + } + + func plain() { + pixels.update(repeating: 0, count: row * 32) + InitPort(port) + var bounds = CRect(top: 0, left: 0, bottom: 32, right: 96) + var bits = BitMap(baseAddr: UnsafeMutableRawPointer(pixels).assumingMemoryBound(to: CChar.self), + rowBytes: Int16(row), bounds: bounds) + SetPortBits(&bits) + port.pointee.portRect = bounds + RectRgn(port.pointee.visRgn, &bounds) + TextFont(family) + TextSize(12) + MoveTo(8, 16) + } + + func picture(_ label: String) { + var line = "\(label) -> pen (\(port.pointee.pnLoc.v),\(port.pointee.pnLoc.h))" + for y in 0 ..< 32 { + line += " " + (0 ..< row).map { String(format: "%02X", pixels[y * row + $0]) }.joined() + } + lines.append(line) + } + + func number(_ label: String, _ value: some BinaryInteger) { + lines.append("\(label) -> \(value)") + } + + func info(_ label: String) { + var info = CQuickDraw.FontInfo() + GetFontInfo(&info) + lines.append("\(label) -> ascent \(info.ascent), descent \(info.descent), widMax \(info.widMax), leading \(info.leading)") + } + + func width(_ text: String) -> Int16 { + pascal(text) { StringWidth($0) } + } + + func draw(_ text: String) { + pascal(text) { DrawString($0) } + } + + /// DrawText, TextWidth and MeasureText take the characters alone. + func buffer(_ text: String, _ body: (UnsafeMutablePointer) -> Result) -> Result { + pascal(text) { body(UnsafeMutableRawPointer($0 + 1).assumingMemoryBound(to: CChar.self)) } + } + + func measures(_ label: String) { + number("StringWidth, \(label)", width(sample)) + var locations = [Int16](repeating: 0, count: 16) + buffer(sample) { text in + locations.withUnsafeMutableBytes { MeasureText(Int16(sample.count), text, $0.baseAddress!.assumingMemoryBound(to: CChar.self)) } + } + lines.append("MeasureText, \(label) ->" + (0 ... sample.count).map { " \(locations[$0])" }.joined()) + } + + func metrics() { + plain() + number("GetFNum", Fonts.registry.number(of: "GraphiteProbe") ?? 0) + for (name, face) in faces { + plain(); TextFace(face) + info("GetFontInfo, \(name)") + measures(name) + number("CharWidth of A, \(name)", CharWidth(65)) + number("CharWidth of space, \(name)", CharWidth(32)) + } + + plain() + for code: Int16 in [32, 46, 65, 66, 87, 97, 102, 103, 105, 106, 90, 126, 13, 9, 0] { + number("CharWidth \(code)", CharWidth(code)) + } + number("CharWidth 200", CharWidth(200)) + number("TextWidth from 0 for 0", buffer(sample) { TextWidth($0, 0, 0) }) + number("TextWidth from 2 for 4", buffer(sample) { TextWidth($0, 2, 4) }) + + for size: Int16 in [12, 24, 18, 9, 6, 36, 13, 0] { + plain(); TextSize(size) + info("GetFontInfo at \(size)") + measures("at \(size)") + TextFace(1) + measures("bold at \(size)") + } + + plain(); SpaceExtra(0x00028000) + number("StringWidth of one space, spExtra 2.5", width(" ")) + number("StringWidth of two spaces, spExtra 2.5", width(" ")) + number("StringWidth of three spaces, spExtra 2.5", width(" ")) + measures("spExtra 2.5") + plain(); SpaceExtra(0x00004000) + number("StringWidth of A space A space A, spExtra 0.25", width("A A A")) + number("StringWidth of five spaces, spExtra 0.25", width(" ")) + plain(); SpaceExtra(-0x00018000) + number("StringWidth of three spaces, spExtra -1.5", width(" ")) + plain(); CharExtra(0x00030000) + number("StringWidth with CharExtra 3 in a GrafPort", width(sample)) + } + + func pen() { + plain(); DrawChar(65); picture("DrawChar A") + plain(); DrawChar(90); picture("DrawChar of a missing character") + plain(); draw(sample); picture("DrawString") + plain(); draw("BZ~a"); picture("DrawString with missing characters") + plain(); buffer(sample) { DrawText($0, 2, 4) }; picture("DrawText from 2 for 4") + plain(); draw(""); picture("DrawString of nothing") + plain(); MoveTo(0, 16); draw("jfA"); picture("DrawString overhanging the left edge") + plain(); MoveTo(90, 16); draw("AW"); picture("DrawString past the right edge") + } + + func styles() { + for (name, face) in faces { + plain(); TextFace(face); draw(sample); picture("style \(name)") + plain(); TextFace(face); draw(pair); picture("style \(name), short") + } + } + + /// Vertical stripes four pixels wide. + func stripes() { + pixels.update(repeating: 0xF0, count: row * 32) + } + + func modes() { + let list = ["srcCopy", "srcOr", "srcXor", "srcBic", "notSrcCopy", "notSrcOr", "notSrcXor", "notSrcBic"] + for (mode, name) in list.enumerated() { + plain(); stripes(); TextMode(Int16(mode)); draw(pair); picture("mode \(name)") + plain(); stripes(); TextMode(Int16(mode)); TextFace(4); draw(pair); picture("mode \(name), underline") + } + plain(); stripes(); TextMode(0); TextFace(2); draw(pair); picture("mode srcCopy, italic") + plain(); stripes(); TextMode(0); TextFace(16); draw(pair); picture("mode srcCopy, shadow") + plain(); stripes(); TextMode(2); TextFace(8); draw(pair); picture("mode srcXor, outline") + } + + func state() { + var half = CPattern() + withUnsafeMutableBytes(of: &half.pat) { $0.copyBytes(from: [0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55] as [UInt8]) } + plain(); ForeColor(30); stripes(); draw(pair); picture("fore color white") + plain(); ForeColor(205); draw(pair); picture("fore color red") + plain(); BackColor(33); TextMode(0); draw(pair); picture("back color black, srcCopy") + plain(); BackPat(&half); TextMode(0); draw(pair); picture("back pattern, srcCopy") + plain(); PenPat(&half); PenMode(10); PenSize(3, 3); draw(pair); picture("pen pattern, mode and size") + plain(); HidePen(); draw(pair); ShowPen(); picture("pen hidden") + plain() + var clip = CRect(top: 10, left: 10, bottom: 18, right: 18) + ClipRect(&clip) + draw(sample) + picture("clipped") + plain(); SetOrigin(4, 2); MoveTo(12, 18); draw(pair); picture("origin 4,2") + plain(); SpaceExtra(0x00028000); draw("a a a"); picture("spExtra 2.5") + plain(); SpaceExtra(0x00028000); TextFace(4); draw("a a a"); picture("spExtra 2.5, underline") + plain(); SpaceExtra(0x00004000); draw(". . . . ."); picture("spExtra 0.25") + plain(); TextFace(4); draw("A g j"); picture("underline over spaces and descenders") + plain(); TextFace(4); DrawChar(103); DrawChar(97); picture("underline, two DrawChars") + plain(); TextFace(2); DrawChar(65); DrawChar(87); picture("italic, two DrawChars") + plain() + let region = NewRgn()! + OpenRgn() + draw(pair) + CloseRgn(region) + number("size of the region of a DrawString", region.pointee!.pointee.rgnSize) + picture("DrawString in an open region") + DisposeRgn(region) + } + + func scaled() { + for size: Int16 in [24, 18, 9, 6] { + plain(); TextSize(size); MoveTo(8, 22); draw(pair); picture("size \(size)") + plain(); TextSize(size); TextFace(1); MoveTo(8, 22); draw(pair); picture("size \(size), bold") + } + } +} + +extension QuickDrawTests { + + /// Text, compared with what Mac OS 9.2.2 did + /// (ReferenceTests/Retro68/TextCapture.c), in the probe's own font. + @Suite struct TextCaptureTests { + + private static let capture: [String: String] = { + let data = try! Data(contentsOf: retro68.appendingPathComponent("Text-macos-9.2.2-ppc.txt")) + var lines: [String: String] = [:] + for line in String(decoding: data, as: UTF8.self).split(separator: "\r").map(String.init) { + if let arrow = line.range(of: " -> ") { lines[String(line[.. = ["style bold condense, short", "size 9", "size 9, bold"] + + @Test func doesWhatMacOSDid() { + let probe = Probe() + probe.metrics() + probe.pen() + probe.styles() + probe.modes() + probe.state() + probe.scaled() + #expect(probe.lines.count == Self.capture.count) + for line in probe.lines { + let label = String(line[.. ")!.lowerBound]) + #expect((Self.capture[label] == line) != Self.knownDifferences.contains(label), + "\(label): \(line.count < 200 ? "\(line) | \(Self.capture[label] ?? "?")" : "")") + } + } + } +} diff --git a/Tests/GraphiteTextTests/TextTests.swift b/Tests/GraphiteTextTests/TextTests.swift index ef99f9a..0d2112b 100644 --- a/Tests/GraphiteTextTests/TextTests.swift +++ b/Tests/GraphiteTextTests/TextTests.swift @@ -56,10 +56,10 @@ import GraphiteText italic.text.face = TextStyle.italic.rawValue italic.move(to: Point(v: 12, h: 1)) italic.drawText("I".unicodeScalars, fonts: fonts) - // A pixel to the right every four rows up. + // A pixel to the right every two rows up. let top = snapshot(italic, rows: 3 ..< 4, columns: 0 ..< 8), bottom = snapshot(italic, rows: 11 ..< 12, columns: 0 ..< 8) #expect(top.firstIndex(of: "#")! > bottom.firstIndex(of: "#")!) - #expect(italic.fontInfo(fonts: fonts).widMax > port().fontInfo(fonts: fonts).widMax) + #expect(italic.fontInfo(fonts: fonts).widMax == port().fontInfo(fonts: fonts).widMax) } @Test func outline() { @@ -137,6 +137,17 @@ import GraphiteText #expect(port.pen.location.h == 1 + 2 * 8) } + @Test func bitmapFontRejectsWhatIsNotAFont() { + #expect(BitmapFont(familyName: "Nothing", size: 12, resource: []) == nil) + #expect(BitmapFont(familyName: "Nothing", size: 12, resource: [UInt8](repeating: 0, count: 8)) == nil) + // A header that promises a strike and tables it hasn't. + var header: [UInt8] = [0x90, 0, 0, 32, 0, 122, 0, 10, 0xFF, 0xFE, 0xFF, 0xFD, 0, 12, 0, 12, 0, 100, 0, 9, 0, 3, 0, 1, 0, 3] + #expect(BitmapFont(familyName: "Nothing", size: 12, resource: header) == nil) + // Not 1 bit. + header[1] = 0x04 + #expect(BitmapFont(familyName: "Nothing", size: 12, resource: header) == nil) + } + @Test func registry() { let fonts = FontRegistry() #expect(fonts.number(of: "geneva") == 3) diff --git a/Tools/quickdraw-abi/README.md b/Tools/quickdraw-abi/README.md index fe80925..e14fa84 100644 --- a/Tools/quickdraw-abi/README.md +++ b/Tools/quickdraw-abi/README.md @@ -46,7 +46,9 @@ headers change only through `generate-headers.py `. the clip calls, `LocalToGlobal`, `GlobalToLocal`, `GetPixel`, `ScrollRect` and `BitMapToRegion`; - the pen, `LineTo` and `Line`, `ForeColor`, `BackColor`, `BackPat`, and the - port's text settings (no text is drawn yet); + port's text settings; +- `DrawChar`, `DrawString`, `DrawText`, `CharWidth`, `StringWidth`, + `TextWidth`, `MeasureText`, `GetFontInfo` and `CharExtra`; - frame, paint, erase, invert and fill of rectangles, ovals, round rectangles, arcs, regions and polygons; - `OpenRgn` and `CloseRgn`, `OpenPoly`, `ClosePoly`, `KillPoly` and @@ -56,7 +58,7 @@ headers change only through `generate-headers.py `. Every other function in `symbols.txt` is exported as a stub that sets `unimpErr` (-4), which `QDError` returns, and gives zero; set `QUICKDRAW_TRACE_UNIMPLEMENTED` to have each one name itself. Color ports, -GWorlds, `CopyDeepMask`, pictures and text are stubs. +GWorlds, `CopyDeepMask` and pictures are stubs. The behaviour is Graphite's engine's. The port, pen and text-setting calls replay what Mac OS 9.2.2 left in a GrafPort @@ -68,7 +70,18 @@ Polygons, region recording and mapping are compared too (`ReferenceTests/Retro68/PolygonCapture.c`); only mapping into an inverted rectangle differs. So are `CopyBits` and `CopyMask` (`ReferenceTests/Retro68/CopyBitsCapture.c`); only a source rectangle outside -its bitmap differs, which Graphite doesn't read. +its bitmap differs, which Graphite doesn't read. Text is compared in a bitmap +font of the probe's own (`ReferenceTests/Retro68/TextCapture.c`); a few pixels +differ in bold condensed text and at 9 points. + +## Text and fonts + +There is no Font Manager in this library, so a program written in C has no way +to add a font: every `TextFont` draws in the built-in 12 point system font, from +Pomme, stretched to other sizes. It has printable ASCII only and its glyphs are +not Chicago's, so widths and pixels differ from a Macintosh's. With Graphite's +`FreeType` option on, the library also links FreeType, though it doesn't use it +yet. ## The screen diff --git a/Tools/quickdraw-abi/conformance/drawing.c b/Tools/quickdraw-abi/conformance/drawing.c index cb50a62..ea0fbde 100644 --- a/Tools/quickdraw-abi/conformance/drawing.c +++ b/Tools/quickdraw-abi/conformance/drawing.c @@ -200,6 +200,26 @@ int main(void) CHECK(black() == 0 && QDError() == noErr); } + { + /* The built-in font: no other can be added from C. */ + static unsigned char hi[] = { 2, 'H', 'i' }; + FontInfo info; + short places[3]; + + clear(); + TextSize(12); + GetFontInfo(&info); + CHECK(info.ascent > 0 && info.widMax > 0); + MoveTo(1, 12); + DrawString(hi); + CHECK(black() > 0 && port.pnLoc.h == 1 + StringWidth(hi)); + CHECK(StringWidth(hi) == CharWidth('H') + CharWidth('i')); + CHECK(TextWidth((Ptr)hi, 1, 2) == StringWidth(hi)); + MeasureText(2, (Ptr)(hi + 1), (Ptr)places); + CHECK(places[0] == 0 && places[1] == CharWidth('H') && places[2] == StringWidth(hi)); + CHECK(QDError() == noErr); + } + ClosePort(&port); clear(); PaintRect(&box); diff --git a/Tools/quickdraw-abi/implemented.txt b/Tools/quickdraw-abi/implemented.txt index 28c8037..ea9921a 100644 --- a/Tools/quickdraw-abi/implemented.txt +++ b/Tools/quickdraw-abi/implemented.txt @@ -111,3 +111,12 @@ MapRgn MapPoly CopyBits CopyMask +DrawChar +DrawString +DrawText +CharWidth +StringWidth +TextWidth +MeasureText +GetFontInfo +CharExtra