mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:47:34 +00:00
LibPDF: Turn Glyph into a class
Glyph was a simple structure, but even now it's become more complex that it was initially. Turning it into a class hides some of that complexity, and make sit easier to understand to external eyes. While doing this I also decided to remove the float + bool combo for keeping track of the glyph's width, and replaced it with an Optional instead.
This commit is contained in:
parent
c084943457
commit
11a9bfd4b6
3 changed files with 27 additions and 18 deletions
|
@ -102,10 +102,10 @@ PDFErrorOr<NonnullRefPtr<CFF>> CFF::create(ReadonlyBytes const& cff_bytes, RefPt
|
|||
|
||||
// Adjust glyphs' widths as they are deltas from nominalWidthX
|
||||
for (auto& glyph : glyphs) {
|
||||
if (!glyph.width_specified)
|
||||
glyph.width = float(defaultWidthX);
|
||||
if (!glyph.has_width())
|
||||
glyph.set_width(float(defaultWidthX));
|
||||
else
|
||||
glyph.width += float(nominalWidthX);
|
||||
glyph.set_width(glyph.width() + float(nominalWidthX));
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < glyphs.size(); i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue