diff --git a/fuzz/FuzzCanvas.cpp b/fuzz/FuzzCanvas.cpp index 36eb6f3ae1..90b318f4fb 100644 --- a/fuzz/FuzzCanvas.cpp +++ b/fuzz/FuzzCanvas.cpp @@ -886,7 +886,7 @@ static SkFont fuzz_font(Fuzz* fuzz) { font.setEmbeddedBitmaps( make_fuzz_t(fuzz)); font.setForceAutoHinting( make_fuzz_t(fuzz)); font.setEmbolden( make_fuzz_t(fuzz)); - font.setHinting( make_fuzz_t_range(fuzz, 0, kFull_SkFontHinting)); + font.setHinting( make_fuzz_t_range(fuzz, 0, SkFontHinting::kFull)); font.setEdging( make_fuzz_t_range(fuzz, 0, (int)SkFont::Edging::kSubpixelAntiAlias)); return font; diff --git a/gm/fontscaler.cpp b/gm/fontscaler.cpp index 3cdbbddfef..ce83a3c531 100644 --- a/gm/fontscaler.cpp +++ b/gm/fontscaler.cpp @@ -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); diff --git a/gm/mac_aa_explorer.cpp b/gm/mac_aa_explorer.cpp index 85de227e3d..add37e6637 100644 --- a/gm/mac_aa_explorer.cpp +++ b/gm/mac_aa_explorer.cpp @@ -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; diff --git a/gm/typeface.cpp b/gm/typeface.cpp index 4e58632e4d..c9f11a3f90 100644 --- a/gm/typeface.cpp +++ b/gm/typeface.cpp @@ -191,10 +191,10 @@ static void draw_typeface_rendering_gm(SkCanvas* canvas, sk_sp 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 { diff --git a/modules/skottie/src/SkottieShaper.cpp b/modules/skottie/src/SkottieShaper.cpp index 07297abc09..933359fc09 100644 --- a/modules/skottie/src/SkottieShaper.cpp +++ b/modules/skottie/src/SkottieShaper.cpp @@ -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); diff --git a/modules/sksg/include/SkSGText.h b/modules/sksg/include/SkSGText.h index ebe7835ffa..10ac04c70a 100644 --- a/modules/sksg/include/SkSGText.h +++ b/modules/sksg/include/SkSGText.h @@ -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 fBlob; // cached text blob diff --git a/site/user/api/undocumented.md b/site/user/api/undocumented.md index 7ff6351df4..813840d280 100644 --- a/site/user/api/undocumented.md +++ b/site/user/api/undocumented.md @@ -267,25 +267,25 @@ void draw(S Value Description - kNo_SkFontHinting + SkFontHinting::kNone 0 - kSlight_SkFontHinting + SkFontHinting::kSlight 1 - kNormal_SkFontHinting + SkFontHinting::kNormal 2 - kFull_SkFontHinting + SkFontHinting::kFull 3 diff --git a/src/core/SkFont.cpp b/src/core/SkFont.cpp index e26c7a2bd1..37735516b8 100644 --- a/src/core/SkFont.cpp +++ b/src/core/SkFont.cpp @@ -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); diff --git a/src/core/SkPaintDefaults.h b/src/core/SkPaintDefaults.h index 4f53253677..ce90fd1803 100644 --- a/src/core/SkPaintDefaults.h +++ b/src/core/SkPaintDefaults.h @@ -21,7 +21,7 @@ #endif #ifndef SkPaintDefaults_Hinting - #define SkPaintDefaults_Hinting kNormal_SkFontHinting + #define SkPaintDefaults_Hinting SkFontHinting::kNormal #endif #ifndef SkPaintDefaults_MiterLimit diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp index 064ceaebb3..11aee174d6 100644 --- a/src/core/SkScalerContext.cpp +++ b/src/core/SkScalerContext.cpp @@ -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 diff --git a/src/core/SkTextBlob.cpp b/src/core/SkTextBlob.cpp index d9d9c5f952..578a13b74f 100644 --- a/src/core/SkTextBlob.cpp +++ b/src/core/SkTextBlob.cpp @@ -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)); diff --git a/src/gpu/text/GrTextContext.cpp b/src/gpu/text/GrTextContext.cpp index 726e5351c4..03374d0ba7 100644 --- a/src/gpu/text/GrTextContext.cpp +++ b/src/gpu/text/GrTextContext.cpp @@ -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); diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp index cb8844a368..422f4d140a 100644 --- a/src/pdf/SkPDFFont.cpp +++ b/src/pdf/SkPDFFont.cpp @@ -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) { diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp index 5627db69b7..c0d0d3c813 100644 --- a/src/ports/SkFontHost_FreeType.cpp +++ b/src/ports/SkFontHost_FreeType.cpp @@ -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 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) { diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp index d66d8f4d21..0c50ffc41d 100644 --- a/src/ports/SkFontHost_mac.cpp +++ b/src/ports/SkFontHost_mac.cpp @@ -1317,7 +1317,7 @@ void SkScalerContext_Mac::generateImage(const SkGlyph& glyph) { CGGlyph cgGlyph = SkTo(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(); diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp index 3d6a7c3818..cc1a8615b8 100644 --- a/src/ports/SkFontHost_win.cpp +++ b/src/ports/SkFontHost_win.cpp @@ -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 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 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"); diff --git a/src/ports/SkScalerContext_win_dw.cpp b/src/ports/SkScalerContext_win_dw.cpp index de911fc730..432356a0f4 100644 --- a/src/ports/SkScalerContext_win_dw.cpp +++ b/src/ports/SkScalerContext_win_dw.cpp @@ -351,7 +351,7 @@ SkScalerContext_DW::SkScalerContext_DW(sk_sp 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; diff --git a/src/ports/SkTypeface_win_dw.cpp b/src/ports/SkTypeface_win_dw.cpp index ea98b162eb..f6ced8502f 100644 --- a/src/ports/SkTypeface_win_dw.cpp +++ b/src/ports/SkTypeface_win_dw.cpp @@ -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); diff --git a/tests/FontHostTest.cpp b/tests/FontHostTest.cpp index b16a73c9cc..15de36566b 100644 --- a/tests/FontHostTest.cpp +++ b/tests/FontHostTest.cpp @@ -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 { diff --git a/tests/GlyphRunTest.cpp b/tests/GlyphRunTest.cpp index 66e47259ae..9bf850769d 100644 --- a/tests/GlyphRunTest.cpp +++ b/tests/GlyphRunTest.cpp @@ -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; diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp index 6bb4819e6d..47bf37aba7 100644 --- a/tests/PaintTest.cpp +++ b/tests/PaintTest.cpp @@ -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); diff --git a/tests/SkRemoteGlyphCacheTest.cpp b/tests/SkRemoteGlyphCacheTest.cpp index 88d577adde..24169b46cc 100644 --- a/tests/SkRemoteGlyphCacheTest.cpp +++ b/tests/SkRemoteGlyphCacheTest.cpp @@ -113,7 +113,7 @@ private: sk_sp buildTextBlob(sk_sp 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 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())); diff --git a/tests/TextBlobTest.cpp b/tests/TextBlobTest.cpp index 6314097453..453f62c29a 100644 --- a/tests/TextBlobTest.cpp +++ b/tests/TextBlobTest.cpp @@ -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); diff --git a/tools/debugger/DrawCommand.cpp b/tools/debugger/DrawCommand.cpp index 5f80845677..d689a53055 100644 --- a/tools/debugger/DrawCommand.cpp +++ b/tools/debugger/DrawCommand.cpp @@ -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; } diff --git a/tools/fonts/RandomScalerContext.cpp b/tools/fonts/RandomScalerContext.cpp index 65ca854d03..cfbd78518b 100644 --- a/tools/fonts/RandomScalerContext.cpp +++ b/tools/fonts/RandomScalerContext.cpp @@ -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; } diff --git a/tools/fonts/TestSVGTypeface.cpp b/tools/fonts/TestSVGTypeface.cpp index e6fe156be3..4069434f9d 100644 --- a/tools/fonts/TestSVGTypeface.cpp +++ b/tools/fonts/TestSVGTypeface.cpp @@ -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 { diff --git a/tools/fonts/TestTypeface.cpp b/tools/fonts/TestTypeface.cpp index e887d3e9a1..7f30f01c1d 100644 --- a/tools/fonts/TestTypeface.cpp +++ b/tools/fonts/TestTypeface.cpp @@ -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 { diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp index cd74346dea..ff0f5ffddd 100644 --- a/tools/viewer/Viewer.cpp +++ b/tools/viewer/Viewer.cpp @@ -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(hintingIdx - 1)); fFontOverrides.fHinting = true;