Use SkFontHinting instead of macros.

Change-Id: Ie7f231295c27010f53f09e9879aa7df74ab2d09b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212507
Auto-Submit: Ben Wagner <bungeman@google.com>
Reviewed-by: Hal Canary <halcanary@skia.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
Ben Wagner 2019-05-07 16:50:29 -04:00 committed by Skia Commit-Bot
parent 15c9142233
commit 5785e4a165
28 changed files with 86 additions and 86 deletions

View File

@ -886,7 +886,7 @@ static SkFont fuzz_font(Fuzz* fuzz) {
font.setEmbeddedBitmaps( make_fuzz_t<bool>(fuzz));
font.setForceAutoHinting( make_fuzz_t<bool>(fuzz));
font.setEmbolden( make_fuzz_t<bool>(fuzz));
font.setHinting( make_fuzz_t_range<SkFontHinting>(fuzz, 0, kFull_SkFontHinting));
font.setHinting( make_fuzz_t_range<SkFontHinting>(fuzz, 0, SkFontHinting::kFull));
font.setEdging( make_fuzz_t_range<SkFont::Edging>(fuzz, 0,
(int)SkFont::Edging::kSubpixelAntiAlias));
return font;

View File

@ -40,7 +40,7 @@ protected:
font.setEdging(SkFont::Edging::kSubpixelAntiAlias);
//With freetype the default (normal hinting) can be really ugly.
//Most distros now set slight (vertical hinting only) in any event.
font.setHinting(kSlight_SkFontHinting);
font.setHinting(SkFontHinting::kSlight);
const char* text = "Hamburgefons ooo mmm";
const size_t textLen = strlen(text);

View File

@ -165,7 +165,7 @@ DEF_SIMPLE_GM(macaa_colors, canvas, 800, 500) {
for (bool lcd : {false, true}) {
font.setEdging(lcd ? SkFont::Edging::kSubpixelAntiAlias
: SkFont::Edging::kAntiAlias);
for (auto h : {kNo_SkFontHinting, kNormal_SkFontHinting}) {
for (auto h : {SkFontHinting::kNone, SkFontHinting::kNormal}) {
font.setHinting(h);
y += font.getSpacing() + 2;

View File

@ -191,10 +191,10 @@ static void draw_typeface_rendering_gm(SkCanvas* canvas, sk_sp<SkTypeface> face,
constexpr SkScalar textSizes[] = { 9, 10, 11, 12, 13, 14, 15, 16 };
constexpr SkFontHinting hintingTypes[] = {
kNo_SkFontHinting,
kSlight_SkFontHinting,
kNormal_SkFontHinting,
kFull_SkFontHinting
SkFontHinting::kNone,
SkFontHinting::kSlight,
SkFontHinting::kNormal,
SkFontHinting::kFull
};
struct SubpixelType {

View File

@ -53,7 +53,7 @@ public:
, fHAlignFactor(HAlignFactor(fDesc.fHAlign))
, fFont(fDesc.fTypeface, fDesc.fTextSize)
, fShaper(SkShaper::Make()) {
fFont.setHinting(kNo_SkFontHinting);
fFont.setHinting(SkFontHinting::kNone);
fFont.setSubpixel(true);
fFont.setLinearMetrics(true);
fFont.setEdging(SkFont::Edging::kAntiAlias);

View File

@ -63,7 +63,7 @@ private:
SkScalar fSkewX = 0;
SkTextUtils::Align fAlign = SkTextUtils::kLeft_Align;
SkFont::Edging fEdging = SkFont::Edging::kAntiAlias;
SkFontHinting fHinting = kNormal_SkFontHinting;
SkFontHinting fHinting = SkFontHinting::kNormal;
sk_sp<SkTextBlob> fBlob; // cached text blob

View File

@ -267,25 +267,25 @@ void <a href='#SkDrawable_draw'>draw</a>(<a href='SkCanvas_Reference#SkCanvas'>S
<th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th>
<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr>
<tr style='background-color: #f0f0f0; '>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kNo_SkFontHinting'><code>kNo_SkFontHinting</code></a></td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkFontHinting::kNone'><code>SkFontHinting::kNone</code></a></td>
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0</td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
</td>
</tr>
<tr>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kSlight_SkFontHinting'><code>kSlight_SkFontHinting</code></a></td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkFontHinting::kSlight'><code>SkFontHinting::kSlight</code></a></td>
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>1</td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
</td>
</tr>
<tr style='background-color: #f0f0f0; '>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kNormal_SkFontHinting'><code>kNormal_SkFontHinting</code></a></td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkFontHinting::kNormal'><code>SkFontHinting::kNormal</code></a></td>
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>2</td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
</td>
</tr>
<tr>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kFull_SkFontHinting'><code>kFull_SkFontHinting</code></a></td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkFontHinting::kFull'><code>SkFontHinting::kFull</code></a></td>
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>3</td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
</td>

View File

@ -121,7 +121,7 @@ SkScalar SkFont::setupForAsPaths(SkPaint* paint) {
kForceAutoHinting_PrivFlag;
fFlags = (fFlags & ~flagsToIgnore) | kSubpixel_PrivFlag;
this->setHinting(kNo_SkFontHinting);
this->setHinting(SkFontHinting::kNone);
if (this->getEdging() == Edging::kSubpixelAntiAlias) {
this->setEdging(Edging::kAntiAlias);
@ -597,7 +597,7 @@ bool SkFontPriv::Unflatten(SkFont* font, SkReadBuffer& buffer) {
font->fEdging = SkToU8(edging);
unsigned hinting = (packed >> kShift_For_Hinting) & kMask_For_Hinting;
if (hinting > (unsigned)kFull_SkFontHinting) {
if (hinting > (unsigned)SkFontHinting::kFull) {
hinting = 0;
}
font->fHinting = SkToU8(hinting);

View File

@ -21,7 +21,7 @@
#endif
#ifndef SkPaintDefaults_Hinting
#define SkPaintDefaults_Hinting kNormal_SkFontHinting
#define SkPaintDefaults_Hinting SkFontHinting::kNormal
#endif
#ifndef SkPaintDefaults_MiterLimit

View File

@ -1039,7 +1039,7 @@ void SkScalerContext::MakeRecAndEffects(const SkFont& font, const SkPaint& paint
// the point of linear-text.
SkFontHinting hinting = (SkFontHinting)font.getHinting();
if (font.isLinearMetrics()) {
hinting = kNo_SkFontHinting;
hinting = SkFontHinting::kNone;
}
rec->setHinting(font.getHinting());
#else

View File

@ -914,7 +914,7 @@ SkTextBaseIter::SkTextBaseIter(const SkGlyphID glyphs[], int count, const SkFont
// can't use our canonical size if we need to apply patheffects
if (fPaint.getPathEffect() == nullptr) {
// If the wrong size is going to be used, don't hint anything.
fFont.setHinting(kNo_SkFontHinting);
fFont.setHinting(SkFontHinting::kNone);
fFont.setSubpixel(true);
fScale = fFont.getSize() / SkFontPriv::kCanonicalTextSizeForPaths;
fFont.setSize(SkIntToScalar(SkFontPriv::kCanonicalTextSizeForPaths));

View File

@ -171,7 +171,7 @@ SkFont GrTextContext::InitDistanceFieldFont(const SkFont& font,
dfFont.setEdging(SkFont::Edging::kAntiAlias);
dfFont.setForceAutoHinting(false);
dfFont.setHinting(kNormal_SkFontHinting);
dfFont.setHinting(SkFontHinting::kNormal);
// The sub-pixel position will always happen when transforming to the screen.
dfFont.setSubpixel(false);

View File

@ -50,7 +50,7 @@
SkExclusiveStrikePtr SkPDFFont::MakeVectorCache(SkTypeface* face, int* size) {
SkFont font;
font.setHinting(kNo_SkFontHinting);
font.setHinting(SkFontHinting::kNone);
font.setEdging(SkFont::Edging::kAlias);
font.setTypeface(sk_ref_sp(face));
int unitsPerEm = face->getUnitsPerEm();
@ -142,7 +142,7 @@ const SkAdvancedTypefaceMetrics* SkPDFFont::GetMetrics(const SkTypeface* typefac
if (0 == metrics->fStemV || 0 == metrics->fCapHeight) {
SkFont font;
font.setHinting(kNo_SkFontHinting);
font.setHinting(SkFontHinting::kNone);
font.setTypeface(sk_ref_sp(typeface));
font.setSize(1000); // glyph coordinate system
if (0 == metrics->fStemV) {

View File

@ -743,14 +743,14 @@ void SkTypeface_FreeType::onFilterRec(SkScalerContextRec* rec) const {
}
SkFontHinting h = rec->getHinting();
if (kFull_SkFontHinting == h && !isLCD(*rec)) {
if (SkFontHinting::kFull == h && !isLCD(*rec)) {
// collapse full->normal hinting if we're not doing LCD
h = kNormal_SkFontHinting;
h = SkFontHinting::kNormal;
}
// rotated text looks bad with hinting, so we disable it as needed
if (!isAxisAligned(*rec)) {
h = kNo_SkFontHinting;
h = SkFontHinting::kNone;
}
rec->setHinting(h);
@ -865,26 +865,26 @@ SkScalerContext_FreeType::SkScalerContext_FreeType(sk_sp<SkTypeface> typeface,
if (SkMask::kBW_Format == fRec.fMaskFormat) {
// See http://code.google.com/p/chromium/issues/detail?id=43252#c24
loadFlags = FT_LOAD_TARGET_MONO;
if (fRec.getHinting() == kNo_SkFontHinting) {
if (fRec.getHinting() == SkFontHinting::kNone) {
loadFlags = FT_LOAD_NO_HINTING;
linearMetrics = true;
}
} else {
switch (fRec.getHinting()) {
case kNo_SkFontHinting:
case SkFontHinting::kNone:
loadFlags = FT_LOAD_NO_HINTING;
linearMetrics = true;
break;
case kSlight_SkFontHinting:
case SkFontHinting::kSlight:
loadFlags = FT_LOAD_TARGET_LIGHT; // This implies FORCE_AUTOHINT
if (gFTLibrary->lightHintingIsYOnly()) {
linearMetrics = true;
}
break;
case kNormal_SkFontHinting:
case SkFontHinting::kNormal:
loadFlags = FT_LOAD_TARGET_NORMAL;
break;
case kFull_SkFontHinting:
case SkFontHinting::kFull:
loadFlags = FT_LOAD_TARGET_NORMAL;
if (isLCD(fRec)) {
if (fLCDIsVert) {

View File

@ -1317,7 +1317,7 @@ void SkScalerContext_Mac::generateImage(const SkGlyph& glyph) {
CGGlyph cgGlyph = SkTo<CGGlyph>(glyph.getGlyphID());
// FIXME: lcd smoothed un-hinted rasterization unsupported.
bool requestSmooth = fRec.getHinting() != kNo_SkFontHinting;
bool requestSmooth = fRec.getHinting() != SkFontHinting::kNone;
// Draw the glyph
size_t cgRowBytes;
@ -2222,7 +2222,7 @@ void SkTypeface_Mac::onFilterRec(SkScalerContextRec* rec) const {
// The above turns off subpixel rendering, but the user requested it.
// Normal hinting will cause the A8 masks to be generated from CoreGraphics subpixel masks.
// See comments below for more details.
rec->setHinting(kNormal_SkFontHinting);
rec->setHinting(SkFontHinting::kNormal);
}
unsigned flagsWeDontSupport = SkScalerContext::kForceAutohinting_Flag |
@ -2236,12 +2236,12 @@ void SkTypeface_Mac::onFilterRec(SkScalerContextRec* rec) const {
// Only two levels of hinting are supported.
// kNo_Hinting means avoid CoreGraphics outline dilation (smoothing).
// kNormal_Hinting means CoreGraphics outline dilation (smoothing) is allowed.
if (rec->getHinting() != kNo_SkFontHinting) {
rec->setHinting(kNormal_SkFontHinting);
if (rec->getHinting() != SkFontHinting::kNone) {
rec->setHinting(SkFontHinting::kNormal);
}
// If smoothing has no effect, don't request it.
if (smoothBehavior == SmoothBehavior::none) {
rec->setHinting(kNo_SkFontHinting);
rec->setHinting(SkFontHinting::kNone);
}
// FIXME: lcd smoothed un-hinted rasterization unsupported.
@ -2266,11 +2266,11 @@ void SkTypeface_Mac::onFilterRec(SkScalerContextRec* rec) const {
if (smoothBehavior == SmoothBehavior::subpixel) {
//CoreGraphics creates 555 masks for smoothed text anyway.
rec->fMaskFormat = SkMask::kLCD16_Format;
rec->setHinting(kNormal_SkFontHinting);
rec->setHinting(SkFontHinting::kNormal);
} else {
rec->fMaskFormat = SkMask::kA8_Format;
if (smoothBehavior != SmoothBehavior::none) {
rec->setHinting(kNormal_SkFontHinting);
rec->setHinting(SkFontHinting::kNormal);
}
}
}
@ -2284,7 +2284,7 @@ void SkTypeface_Mac::onFilterRec(SkScalerContextRec* rec) const {
// Unhinted A8 masks (those not derived from LCD masks) must respect SK_GAMMA_APPLY_TO_A8.
// All other masks can use regular gamma.
if (SkMask::kA8_Format == rec->fMaskFormat && kNo_SkFontHinting == rec->getHinting()) {
if (SkMask::kA8_Format == rec->fMaskFormat && SkFontHinting::kNone == rec->getHinting()) {
#ifndef SK_GAMMA_APPLY_TO_A8
// SRGBTODO: Is this correct? Do we want contrast boost?
rec->ignorePreBlend();

View File

@ -88,7 +88,7 @@ static bool needToRenderWithSkia(const SkScalerContextRec& rec) {
return true;
}
#endif
return rec.getHinting() == kNo_SkFontHinting || rec.getHinting() == kSlight_SkFontHinting;
return rec.getHinting() == SkFontHinting::kNone || rec.getHinting() == SkFontHinting::kSlight;
}
static void tchar_to_skstring(const TCHAR t[], SkString* s) {
@ -637,7 +637,7 @@ SkScalerContext_GDI::SkScalerContext_GDI(sk_sp<LogFontTypeface> rawTypeface,
// When GDI hinting, remove the entire Y scale from sA and GsA. (Prevents 'linear' metrics.)
// When not hinting, remove only the integer Y scale from sA and GsA. (Applied by GDI.)
SkScalerContextRec::PreMatrixScale scaleConstraints =
(fRec.getHinting() == kNo_SkFontHinting || fRec.getHinting() == kSlight_SkFontHinting)
(fRec.getHinting() == SkFontHinting::kNone || fRec.getHinting() == SkFontHinting::kSlight)
? SkScalerContextRec::kVerticalInteger_PreMatrixScale
: SkScalerContextRec::kVertical_PreMatrixScale;
SkVector scale;
@ -1486,7 +1486,7 @@ bool SkScalerContext_GDI::generatePath(SkGlyphID glyph, SkPath* path) {
//GDI only uses hinted outlines when axis aligned.
UINT format = GGO_NATIVE | GGO_GLYPH_INDEX;
if (fRec.getHinting() == kNo_SkFontHinting || fRec.getHinting() == kSlight_SkFontHinting){
if (fRec.getHinting() == SkFontHinting::kNone || fRec.getHinting() == SkFontHinting::kSlight){
format |= GGO_UNHINTED;
}
SkAutoSTMalloc<BUFFERSIZE, uint8_t> glyphbuf(BUFFERSIZE);
@ -1495,7 +1495,7 @@ bool SkScalerContext_GDI::generatePath(SkGlyphID glyph, SkPath* path) {
return false;
}
if (fRec.getHinting() != kSlight_SkFontHinting) {
if (fRec.getHinting() != SkFontHinting::kSlight) {
sk_path_from_gdi_path(path, glyphbuf, total_size);
} else {
//GDI only uses hinted outlines when axis aligned.
@ -2079,21 +2079,21 @@ void LogFontTypeface::onFilterRec(SkScalerContextRec* rec) const {
SkFontHinting h = rec->getHinting();
switch (h) {
case kNo_SkFontHinting:
case SkFontHinting::kNone:
break;
case kSlight_SkFontHinting:
case SkFontHinting::kSlight:
// Only do slight hinting when axis aligned.
// TODO: re-enable slight hinting when FontHostTest can pass.
//if (!isAxisAligned(*rec)) {
h = kNo_SkFontHinting;
h = SkFontHinting::kNone;
//}
break;
case kNormal_SkFontHinting:
case kFull_SkFontHinting:
case SkFontHinting::kNormal:
case SkFontHinting::kFull:
// TODO: need to be able to distinguish subpixel positioned glyphs
// and linear metrics.
//rec->fFlags &= ~SkScalerContext::kSubpixelPositioning_Flag;
h = kNormal_SkFontHinting;
h = SkFontHinting::kNormal;
break;
default:
SkDEBUGFAIL("unknown hinting");

View File

@ -351,7 +351,7 @@ SkScalerContext_DW::SkScalerContext_DW(sk_sp<DWriteFontTypeface> typefaceRef,
// DirectWrite2 allows hinting to be disabled.
fGridFitMode = DWRITE_GRID_FIT_MODE_ENABLED;
if (fRec.getHinting() == kNo_SkFontHinting) {
if (fRec.getHinting() == SkFontHinting::kNone) {
fGridFitMode = DWRITE_GRID_FIT_MODE_DISABLED;
if (fRenderingMode != DWRITE_RENDERING_MODE_ALIASED) {
fRenderingMode = DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC;

View File

@ -350,8 +350,8 @@ void DWriteFontTypeface::onFilterRec(SkScalerContextRec* rec) const {
SkFontHinting h = rec->getHinting();
// DirectWrite2 allows for hinting to be turned off. Force everything else to normal.
if (h != kNo_SkFontHinting || !fFactory2 || !fDWriteFontFace2) {
h = kNormal_SkFontHinting;
if (h != SkFontHinting::kNone || !fFactory2 || !fDWriteFontFace2) {
h = SkFontHinting::kNormal;
}
rec->setHinting(h);

View File

@ -206,15 +206,15 @@ static void test_advances(skiatest::Reporter* reporter) {
bool linear;
bool subpixel;
} settings[] = {
{ kNo_SkFontHinting, false, false },
{ kNo_SkFontHinting, true, false },
{ kNo_SkFontHinting, false, true },
{ kSlight_SkFontHinting, false, false },
{ kSlight_SkFontHinting, true, false },
{ kSlight_SkFontHinting, false, true },
{ kNormal_SkFontHinting, false, false },
{ kNormal_SkFontHinting, true, false },
{ kNormal_SkFontHinting, false, true },
{ SkFontHinting::kNone, false, false },
{ SkFontHinting::kNone, true, false },
{ SkFontHinting::kNone, false, true },
{ SkFontHinting::kSlight, false, false },
{ SkFontHinting::kSlight, true, false },
{ SkFontHinting::kSlight, false, true },
{ SkFontHinting::kNormal, false, false },
{ SkFontHinting::kNormal, true, false },
{ SkFontHinting::kNormal, false, true },
};
static const struct {

View File

@ -50,7 +50,7 @@ DEF_TEST(GlyphRunBlob, reporter) {
SkFont font;
font.setTypeface(tf);
font.setHinting(kNormal_SkFontHinting);
font.setHinting(SkFontHinting::kNormal);
font.setSize(1u);
SkTextBlobBuilder blobBuilder;

View File

@ -262,7 +262,7 @@ DEF_TEST(Font_getpos, r) {
for (bool subpix : { false, true }) {
font.setSubpixel(subpix);
for (auto hint : { kNo_SkFontHinting, kSlight_SkFontHinting, kNormal_SkFontHinting, kFull_SkFontHinting}) {
for (auto hint : { SkFontHinting::kNone, SkFontHinting::kSlight, SkFontHinting::kNormal, SkFontHinting::kFull}) {
font.setHinting(hint);
for (auto size : { 1.0f, 12.0f, 100.0f }) {
font.setSize(size);

View File

@ -113,7 +113,7 @@ private:
sk_sp<SkTextBlob> buildTextBlob(sk_sp<SkTypeface> tf, int glyphCount) {
SkFont font;
font.setTypeface(tf);
font.setHinting(kNormal_SkFontHinting);
font.setHinting(SkFontHinting::kNormal);
font.setSize(1u);
font.setEdging(SkFont::Edging::kAntiAlias);
font.setSubpixel(true);
@ -482,7 +482,7 @@ sk_sp<SkTextBlob> make_blob_causing_fallback(
SkFont font;
font.setSubpixel(true);
font.setSize(96);
font.setHinting(kNormal_SkFontHinting);
font.setHinting(SkFontHinting::kNormal);
font.setTypeface(targetTf);
REPORTER_ASSERT(reporter, !SkDraw::ShouldDrawTextAsPaths(font, SkPaint(), SkMatrix::I()));
@ -575,7 +575,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkRemoteGlyphCache_DrawTextAsSDFTWithAllARGBF
SkFont font;
font.setSubpixel(true);
font.setSize(96);
font.setHinting(kNormal_SkFontHinting);
font.setHinting(SkFontHinting::kNormal);
font.setTypeface(typeface);
REPORTER_ASSERT(reporter, !SkDraw::ShouldDrawTextAsPaths(font, SkPaint(), SkMatrix::I()));

View File

@ -178,7 +178,7 @@ public:
font.setScaleX(4.2f);
font.setTypeface(ToolUtils::create_portable_typeface());
font.setSkewX(0.42f);
font.setHinting(kFull_SkFontHinting);
font.setHinting(SkFontHinting::kFull);
font.setEdging(SkFont::Edging::kSubpixelAntiAlias);
font.setEmbolden(true);
font.setLinearMetrics(true);

View File

@ -729,16 +729,16 @@ static void apply_font_hinting(const SkFont& font, SkJSONWriter& writer) {
SkFontHinting hinting = font.getHinting();
if (hinting != SkPaintDefaults_Hinting) {
switch (hinting) {
case kNo_SkFontHinting:
case SkFontHinting::kNone:
writer.appendString(DEBUGCANVAS_ATTRIBUTE_HINTING, DEBUGCANVAS_HINTING_NONE);
break;
case kSlight_SkFontHinting:
case SkFontHinting::kSlight:
writer.appendString(DEBUGCANVAS_ATTRIBUTE_HINTING, DEBUGCANVAS_HINTING_SLIGHT);
break;
case kNormal_SkFontHinting:
case SkFontHinting::kNormal:
writer.appendString(DEBUGCANVAS_ATTRIBUTE_HINTING, DEBUGCANVAS_HINTING_NORMAL);
break;
case kFull_SkFontHinting:
case SkFontHinting::kFull:
writer.appendString(DEBUGCANVAS_ATTRIBUTE_HINTING, DEBUGCANVAS_HINTING_FULL);
break;
}

View File

@ -152,7 +152,7 @@ SkScalerContext* SkRandomTypeface::onCreateScalerContext(const SkScalerContextEf
void SkRandomTypeface::onFilterRec(SkScalerContextRec* rec) const {
fProxy->filterRec(rec);
rec->setHinting(kNo_SkFontHinting);
rec->setHinting(SkFontHinting::kNone);
rec->fMaskFormat = SkMask::kARGB32_Format;
}

View File

@ -127,7 +127,7 @@ void TestSVGTypeface::getAdvance(SkGlyph* glyph) const {
void TestSVGTypeface::getFontMetrics(SkFontMetrics* metrics) const { *metrics = fFontMetrics; }
void TestSVGTypeface::onFilterRec(SkScalerContextRec* rec) const {
rec->setHinting(kNo_SkFontHinting);
rec->setHinting(SkFontHinting::kNone);
}
void TestSVGTypeface::getGlyphToUnicodeMap(SkUnichar* glyphToUnicode) const {

View File

@ -110,7 +110,7 @@ void TestTypeface::getPath(SkGlyphID glyphID, SkPath* path) {
}
void TestTypeface::onFilterRec(SkScalerContextRec* rec) const {
rec->setHinting(kNo_SkFontHinting);
rec->setHinting(SkFontHinting::kNone);
}
void TestTypeface::getGlyphToUnicodeMap(SkUnichar* glyphToUnicode) const {

View File

@ -442,20 +442,20 @@ Viewer::Viewer(int argc, char** argv, void* platformData)
fCommands.addCommand('H', "Font", "Hinting mode", [this]() {
if (!fFontOverrides.fHinting) {
fFontOverrides.fHinting = true;
fFont.setHinting(kNo_SkFontHinting);
fFont.setHinting(SkFontHinting::kNone);
} else {
switch (fFont.getHinting()) {
case kNo_SkFontHinting:
fFont.setHinting(kSlight_SkFontHinting);
case SkFontHinting::kNone:
fFont.setHinting(SkFontHinting::kSlight);
break;
case kSlight_SkFontHinting:
fFont.setHinting(kNormal_SkFontHinting);
case SkFontHinting::kSlight:
fFont.setHinting(SkFontHinting::kNormal);
break;
case kNormal_SkFontHinting:
fFont.setHinting(kFull_SkFontHinting);
case SkFontHinting::kNormal:
fFont.setHinting(SkFontHinting::kFull);
break;
case kFull_SkFontHinting:
fFont.setHinting(kNo_SkFontHinting);
case SkFontHinting::kFull:
fFont.setHinting(SkFontHinting::kNone);
fFontOverrides.fHinting = false;
break;
}
@ -834,16 +834,16 @@ void Viewer::updateTitle() {
if (fFontOverrides.fHinting) {
switch (fFont.getHinting()) {
case kNo_SkFontHinting:
case SkFontHinting::kNone:
paintTitle.append("No Hinting");
break;
case kSlight_SkFontHinting:
case SkFontHinting::kSlight:
paintTitle.append("Slight Hinting");
break;
case kNormal_SkFontHinting:
case SkFontHinting::kNormal:
paintTitle.append("Normal Hinting");
break;
case kFull_SkFontHinting:
case SkFontHinting::kFull:
paintTitle.append("Full Hinting");
break;
}
@ -1752,7 +1752,7 @@ void Viewer::drawImGui() {
{
if (hintingIdx == 0) {
fFontOverrides.fHinting = false;
fFont.setHinting(kNo_SkFontHinting);
fFont.setHinting(SkFontHinting::kNone);
} else {
fFont.setHinting(SkTo<SkFontHinting>(hintingIdx - 1));
fFontOverrides.fHinting = true;