-
-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Labels
buglib/fontlibcIssues related to the font rendering libraryIssues related to the font rendering library
Description
fontlib_GetGlyphWidth and util.GetGlyphWidth does the wrong comparison when totalGlyphs is not 256. They return an error if (codepoint - firstGlyph) >= totalGlyphs instead of (codepoint - firstGlyph) < totalGlyphs).
fontlib_GetGlyphWidth:
; Returns the width of a given glyph.
; Arguments:
; arg0: Codepoint
; Returns:
; Width of glyph
; Zero if invalid index
ld hl,arg0
add hl,sp
ld a,(hl)
; jp util.GetGlyphWidth
assert $ = util.GetGlyphWidth
;-------------------------------------------------------------------------------
util.GetGlyphWidth:
; Internal-use version
; Input:
; A: Codepoint
; Output:
; A: Width
; C if invalid codepoint,NC if valid
; Destroys:
; DE
; HL
; Subtract out firstGlyph
ld hl,_CurrentFontProperties.firstGlyph
sub a,(hl)
; Validate that the glyph index is actually valid
jr nc,.checkMaxIndex
.invalidIndex:
xor a,a
scf
ret
.checkMaxIndex:
ld hl,_CurrentFontProperties.totalGlyphs
cp a,(hl)
jr c,.invalidIndex
; Look up width
or a,a
sbc hl,hl
ld l,a
ld de,(_CurrentFontProperties.widthsTablePtr)
add hl,de
ld a,(hl)
retMetadata
Metadata
Assignees
Labels
buglib/fontlibcIssues related to the font rendering libraryIssues related to the font rendering library