Skip to content

Commit

Permalink
refactor getRectAndMetrics
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislawpuda-tomtom committed Jan 22, 2025
1 parent 83472aa commit 94bdeb4
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/symbol/shaping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -639,22 +639,19 @@ function getRectAndMetrics(
[_: number]: StyleGlyph;
};
},

Check warning on line 641 in src/symbol/shaping.ts

View check run for this annotation

Codecov / codecov/patch

src/symbol/shaping.ts#L638-L641

Added lines #L638 - L641 were not covered by tests
section: SectionOptions, codePoint: number
) {
let rect: Rect = null;
let metrics: GlyphMetrics = null;

section: SectionOptions,
codePoint: number
): GlyphPosition | null {
if (glyphPosition && glyphPosition.rect) {
rect = glyphPosition.rect;
metrics = glyphPosition.metrics;
} else {
const glyphs = glyphMap[section.fontStack];
const glyph = glyphs && glyphs[codePoint];
if (!glyph) return null;
metrics = glyph.metrics;
return glyphPosition;
}

return {rect, metrics};
const glyphs = glyphMap[section.fontStack];
const glyph = glyphs && glyphs[codePoint];
if (!glyph) return null;

const metrics = glyph.metrics;
return {rect: null, metrics};
}

function shapeLines(shaping: Shaping,
Expand Down

0 comments on commit 94bdeb4

Please sign in to comment.