Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions impeller/typographer/backends/skia/text_frame_skia.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ static Font ToFont(const SkTextBlobRunIterator& run, Scalar scale) {
Font::Metrics metrics;
metrics.scale = scale;
metrics.point_size = font.getSize();
metrics.embolden = font.isEmbolden();
metrics.skewX = font.getSkewX();

return Font{std::move(typeface), metrics};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@ static void DrawGlyph(SkCanvas* canvas,
SkFont sk_font(
TypefaceSkia::Cast(*font_glyph.font.GetTypeface()).GetSkiaTypeface(),
metrics.point_size);
sk_font.setEdging(SkFont::Edging::kAntiAlias);
sk_font.setHinting(SkFontHinting::kSlight);
sk_font.setEmbolden(metrics.embolden);
sk_font.setSkewX(metrics.skewX);

auto glyph_color = SK_ColorWHITE;

SkPaint glyph_paint;
Expand Down
6 changes: 5 additions & 1 deletion impeller/typographer/font.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "impeller/base/comparable.h"
#include "impeller/typographer/glyph.h"
#include "impeller/typographer/typeface.h"
#include "include/core/SkFont.h"

namespace impeller {

Expand Down Expand Up @@ -38,9 +39,12 @@ class Font : public Comparable<Font> {
/// The point size of the font.
///
Scalar point_size = 12.0f;
bool embolden = false;
Scalar skewX = 0.0f;

constexpr bool operator==(const Metrics& o) const {
return scale == o.scale && point_size == o.point_size;
return scale == o.scale && point_size == o.point_size &&
embolden == o.embolden && skewX == o.skewX;
}
};

Expand Down