Repository navigation
Draw and measure text in libQuickDraw - #71
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
libQuickDraw now draws and measures text.
DrawChar,DrawString,DrawText,CharWidth,StringWidth,TextWidth,MeasureText,GetFontInfoandCharExtrareplace their stubs (121 of 305 functions implemented).Behaviour from the Mac
ReferenceTests/Retro68/TextCapture.cran on Mac OS 9.2.2. It draws in a smallNFNTfont of its own (TextCapture.r), so the comparison is pixel for pixel without any of Apple's fonts. The test replays it through the C API: 242 of 245 lines match. The three that don't are one pixel at the right edge of bold condensed text, and a few pixels in two pictures shrunk to 9 points. The rules found are listed inReferenceTests/Retro68/README.md.Changes beyond the C API
GraphiteText's drawing is rewritten to those rules: characters are drawn into a strip, styled, stretched if the face has only another size, then put on the port. The earlier styling had not been measured and was wrong in italic slant, underline, outline with shadow, and scaling. This also changesTextLayoutdrawing and text in pictures.BitmapFontis new: a face from anNFNTorFONTresource.FontFacegainsstrikeSizeandkerning, both with defaults.GraphiteText, and so FreeType whenGRAPHITE_FREETYPEis on, though it doesn't use it yet.Limits
TextFontdraws in the built-in system font: printable ASCII only, with widths unlike Chicago's or Geneva's.bicandnotmodes,srcCopyandSpaceExtraat scaled sizes, and where the pen ends after a half-pixel width.Verification
pure.c(26 checks) anddrawing.c(47 checks) pass.