From fcac00f2f19e345e813f38f7fc9372b6d6eebf4b Mon Sep 17 00:00:00 2001 From: Herb Derby Date: Tue, 1 May 2018 11:57:56 -0400 Subject: Reland "Remove devKerning" This is a reland of c86c5c0144b85d0bc8ec791f9609ee2d4e7d835a Original change's description: > Remove devKerning > > Dev kerning is not supported by any scalers. This is > mostly removed. The remaining fields fRsbDelta and > fLsbDelta are kept to keep Android compiling. > > Change-Id: If1a9ee9bb599d4e1bdf4b3751ac0c65246350809 > Reviewed-on: https://skia-review.googlesource.com/124921 > Reviewed-by: Ben Wagner > Commit-Queue: Herb Derby Change-Id: Ibf5fac5f1442c7e62392d5146ad460da27b10d5c Reviewed-on: https://skia-review.googlesource.com/125300 Reviewed-by: Herb Derby Reviewed-by: Mike Klein Commit-Queue: Herb Derby --- docs/SkPaint_Reference.bmh | 307 +++++++++++++++-------------------- gn/core.gni | 1 - include/core/SkPaint.h | 7 +- samplecode/SampleText.cpp | 3 +- src/core/SkAutoKern.h | 51 ------ src/core/SkDraw.cpp | 1 - src/core/SkFindAndPlaceGlyph.h | 38 ++--- src/core/SkGlyph.cpp | 2 - src/core/SkGlyph.h | 4 +- src/core/SkPaint.cpp | 161 ++++-------------- src/core/SkScalerContext.cpp | 15 -- src/core/SkScalerContext.h | 2 +- src/core/SkTextBlob.cpp | 1 - src/core/SkTextToPathIter.h | 2 - src/gpu/text/GrAtlasTextContext.cpp | 11 +- src/gpu/text/GrTextUtils.cpp | 2 +- src/ports/SkFontHost_FreeType.cpp | 10 -- src/ports/SkFontHost_mac.cpp | 3 +- src/ports/SkFontHost_win.cpp | 3 - src/ports/SkScalerContext_win_dw.cpp | 6 - src/ports/SkTypeface_win_dw.cpp | 1 - tests/TextBlobTest.cpp | 2 - tools/debugger/SkDrawCommand.cpp | 1 - 23 files changed, 192 insertions(+), 442 deletions(-) delete mode 100644 src/core/SkAutoKern.h diff --git a/docs/SkPaint_Reference.bmh b/docs/SkPaint_Reference.bmh index 47627361d4..677d5c1da5 100644 --- a/docs/SkPaint_Reference.bmh +++ b/docs/SkPaint_Reference.bmh @@ -12,7 +12,7 @@ Paint controls options applied when drawing and measuring. Paint collects all options outside of the Canvas_Clip and Canvas_Matrix. -Various options apply to text, strokes and fills, and images. +Various options apply to text, strokes and fills, and images. Some options may not be implemented on all platforms; in these cases, setting the option has no effect. Some options are conveniences that duplicate Canvas @@ -21,14 +21,14 @@ functionality; for instance, text size is identical to matrix scale. Paint options are rarely exclusive; each option modifies a stage of the drawing pipeline and multiple pipeline stages may be affected by a single Paint. -Paint collects effects and filters that describe single-pass and multiple-pass +Paint collects effects and filters that describe single-pass and multiple-pass algorithms that alter the drawing geometry, color, and transparency. For instance, -Paint does not directly implement dashing or blur, but contains the objects that do so. +Paint does not directly implement dashing or blur, but contains the objects that do so. The objects contained by Paint are opaque, and cannot be edited outside of the Paint to affect it. The implementation is free to defer computations associated with the Paint, or ignore them altogether. For instance, some GPU implementations draw all -Path geometries with Anti-aliasing, regardless of how SkPaint::kAntiAlias_Flag +Path geometries with Anti-aliasing, regardless of how SkPaint::kAntiAlias_Flag is set in Paint. Paint describes a single color, a single font, a single image quality, and so on. @@ -108,7 +108,7 @@ Constructs Paint with default values. #Table ## The flags, text size, hinting, and miter limit may be overridden at compile time by defining -paint default values. The overrides may be included in "SkUserConfig.h" or predefined by the +paint default values. The overrides may be included in "SkUserConfig.h" or predefined by the build system. #Return default initialized Paint ## @@ -226,7 +226,7 @@ Decreases Paint Reference_Count of owned objects: Typeface, Path_Effect, Shader, Mask_Filter, Color_Filter, Draw_Looper, and Image_Filter. If the objects containing Reference_Count go to zero, they are deleted. -#NoExample +#NoExample ## ## @@ -428,21 +428,21 @@ as the Font_Engine. #Const kSlight_Hinting 1 Modifies glyph outlines minimally to improve constrast. With FreeType, this is equivalent in spirit to the - FT_LOAD_TARGET_LIGHT value supplied to FT_Load_Glyph. It chooses a + FT_LOAD_TARGET_LIGHT value supplied to FT_Load_Glyph. It chooses a lighter hinting algorithm for non-monochrome modes. Generated Glyphs may be fuzzy but better resemble their original shape. ## #Const kNormal_Hinting 2 Modifies glyph outlines to improve constrast. This is the default. With FreeType, this supplies FT_LOAD_TARGET_NORMAL to FT_Load_Glyph, - choosing the default hinting algorithm, which is optimized for standard - gray-level rendering. + choosing the default hinting algorithm, which is optimized for standard + gray-level rendering. ## #Const kFull_Hinting 3 Modifies glyph outlines for maxiumum constrast. With FreeType, this selects - FT_LOAD_TARGET_LCD or FT_LOAD_TARGET_LCD_V if kLCDRenderText_Flag is set. - FT_LOAD_TARGET_LCD is a variant of FT_LOAD_TARGET_NORMAL optimized for - horizontally decimated LCD displays; FT_LOAD_TARGET_LCD_V is a + FT_LOAD_TARGET_LCD or FT_LOAD_TARGET_LCD_V if kLCDRenderText_Flag is set. + FT_LOAD_TARGET_LCD is a variant of FT_LOAD_TARGET_NORMAL optimized for + horizontally decimated LCD displays; FT_LOAD_TARGET_LCD_V is a variant of FT_LOAD_TARGET_NORMAL optimized for vertically decimated LCD displays. ## @@ -500,7 +500,7 @@ Set SkPaintDefaults_Hinting at compile time to change the default setting. # kNo_Hinting # 0 # leaves glyph outlines unchanged from their native representation ## # kSlight_Hinting # 1 # modifies glyph outlines minimally to improve contrast ## # kNormal_Hinting # 2 # modifies glyph outlines to improve contrast ## - # kFull_Hinting # 3 # modifies glyph outlines for maximum contrast ## + # kFull_Hinting # 3 # modifies glyph outlines for maximum contrast ## ## #Param hintingLevel one of: kNo_Hinting, kSlight_Hinting, kNormal_Hinting, kFull_Hinting ## @@ -548,7 +548,7 @@ with a custom definition of SkPaintDefaults_Flags. All flags can be read and written explicitly; Flags allows manipulating multiple settings at once. - #Const kAntiAlias_Flag 0x0001 + #Const kAntiAlias_Flag 0x0001 mask for setting Anti-alias ## #Const kDither_Flag 0x0004 @@ -562,16 +562,16 @@ multiple settings at once. mask for setting Linear_Text ## #Const kSubpixelText_Flag 0x0080 - mask for setting Subpixel_Text + mask for setting Subpixel_Text ## #Const kDevKernText_Flag 0x0100 - mask for setting Full_Hinting_Spacing + #Deprecated ## #Const kLCDRenderText_Flag 0x0200 mask for setting LCD_Text ## #Const kEmbeddedBitmapText_Flag 0x0400 - mask for setting Font_Embedded_Bitmaps + mask for setting Font_Embedded_Bitmaps ## #Const kAutoHinting_Flag 0x0800 mask for setting Automatic_Hinting @@ -663,7 +663,7 @@ Anti-alias drawing approximates partial pixel coverage with transparency. If kAntiAlias_Flag is clear, pixel centers contained by the shape edge are drawn opaque. If kAntiAlias_Flag is set, pixels are drawn with Color_Alpha equal to their coverage. -The rule for Aliased pixels is inconsistent across platforms. A shape edge +The rule for Aliased pixels is inconsistent across platforms. A shape edge passing through the pixel center may, but is not required to, draw the pixel. Raster_Engine draws Aliased pixels whose centers are on or to the right of the start of an @@ -767,10 +767,10 @@ at compile time. #Subtopic Dither #Line # distributing color error ## -Dither increases fidelity by adjusting the color of adjacent pixels. +Dither increases fidelity by adjusting the color of adjacent pixels. This can help to smooth color transitions and reducing banding in gradients. Dithering lessens visible banding from kRGB_565_SkColorType -and kRGBA_8888_SkColorType gradients, +and kRGBA_8888_SkColorType gradients, and improves rendering into a kRGB_565_SkColorType Surface. Dithering is always enabled for linear gradients drawing into @@ -791,7 +791,7 @@ SK_IGNORE_GPU_DITHER to ignore Dither on GPU_Surface. #Example -#Description +#Description Dithering in the bottom half more closely approximates the requested color by alternating nearby colors from pixel to pixel. ## @@ -817,7 +817,7 @@ void draw(SkCanvas* canvas) { ## #Example -#Description +#Description Dithering introduces subtle adjustments to color to smooth gradients. Drawing the gradient repeatedly with SkBlendMode::kPlus exaggerates the dither, making it easier to see. @@ -849,7 +849,7 @@ void draw(SkCanvas* canvas) { #In Dither #Line # returns true if Dither is set ## If true, color error may be distributed to smooth color transition. - + Equivalent to getFlags masked with kDither_Flag. #Return kDither_Flag state ## @@ -905,19 +905,19 @@ void draw(SkCanvas* canvas) { LCD_Text and Subpixel_Text increase the precision of glyph position. -When set, Flags kLCDRenderText_Flag takes advantage of the organization of Color_RGB stripes that +When set, Flags kLCDRenderText_Flag takes advantage of the organization of Color_RGB stripes that create a color, and relies on the small size of the stripe and visual perception to make the color fringing imperceptible. LCD_Text can be enabled on devices that orient stripes horizontally or vertically, and that order the color components as Color_RGB or Color_RBG. -Flags kSubpixelText_Flag uses the pixel transparency to represent a fractional offset. +Flags kSubpixelText_Flag uses the pixel transparency to represent a fractional offset. As the opaqueness of the color increases, the edge of the glyph appears to move towards the outside of the pixel. Either or both techniques can be enabled. kLCDRenderText_Flag and kSubpixelText_Flag are clear by default. -LCD_Text or Subpixel_Text can be enabled by default by setting SkPaintDefaults_Flags to +LCD_Text or Subpixel_Text can be enabled by default by setting SkPaintDefaults_Flags to kLCDRenderText_Flag or kSubpixelText_Flag (or both) at compile time. #Example @@ -1017,7 +1017,7 @@ If kLinearText_Flag is clear, it is the same as setting Hinting to kNo_Hinting. canvas->drawString(width, 128, 0, paint); } } - } + } ## #SeeAlso isLinearText Hinting @@ -1029,12 +1029,12 @@ If kLinearText_Flag is clear, it is the same as setting Hinting to kNo_Hinting. #Alias Subpixel_Text #Line # uses pixel transparency to represent fractional offset ## -Flags kSubpixelText_Flag uses the pixel transparency to represent a fractional offset. +Flags kSubpixelText_Flag uses the pixel transparency to represent a fractional offset. As the opaqueness of the color increases, the edge of the glyph appears to move towards the outside of the pixel. #Method bool isSubpixelText() const - + #In Subpixel_Text #Line # returns true if Subpixel_Text is set ## If true, Glyphs at different sub-pixel positions may differ on pixel edge coverage. @@ -1090,7 +1090,7 @@ SkDebugf("paint.isSubpixelText() %c= !!(paint.getFlags() & SkPaint::kSubpixelTex #Line # text relying on the order of Color_RGB stripes ## #Alias LCD_Text # makes this a top level name, since it is under subtopic Device_Text -When set, Flags kLCDRenderText_Flag takes advantage of the organization of Color_RGB stripes that +When set, Flags kLCDRenderText_Flag takes advantage of the organization of Color_RGB stripes that create a color, and relies on the small size of the stripe and visual perception to make the color fringing imperceptible. LCD_Text can be enabled on devices that orient stripes horizontally or vertically, and that order @@ -1156,7 +1156,7 @@ SkDebugf("paint.isLCDRenderText() %c= !!(paint.getFlags() & SkPaint::kLCDRenderT Font_Embedded_Bitmaps allows selecting custom sized bitmap Glyphs. Flags kEmbeddedBitmapText_Flag when set chooses an embedded bitmap glyph over an outline contained -in a font if the platform supports this option. +in a font if the platform supports this option. FreeType selects the bitmap glyph if available when kEmbeddedBitmapText_Flag is set, and selects the outline glyph if kEmbeddedBitmapText_Flag is clear. @@ -1343,7 +1343,7 @@ is positioned to the right of the preceding glyph. Vertical_Text sets successive Glyphs to position below the preceding glyph. Skia can translate text character codes as a series of Glyphs, but does not implement -font substitution, +font substitution, textual substitution, line layout, or contextual spacing like Kerning pairs. Use a text shaping engine like #A HarfBuzz # http://harfbuzz.org/ ## @@ -1434,12 +1434,12 @@ Fake_Bold approximates the bold font style accompanying a normal font when a bol is not available. Skia does not provide font substitution; it is up to the client to find the bold font face using the platform Font_Manager. -Use Text_Skew_X to approximate an italic font style when the italic font face +Use Text_Skew_X to approximate an italic font style when the italic font face is not available. A FreeType based port may define SK_USE_FREETYPE_EMBOLDEN at compile time to direct the font engine to create the bold Glyphs. Otherwise, the extra bold is computed -by increasing the stroke width and setting the Style to kStrokeAndFill_Style as needed. +by increasing the stroke width and setting the Style to kStrokeAndFill_Style as needed. Fake_Bold is disabled by default. @@ -1527,48 +1527,11 @@ Full_Hinting_Spacing is not related to text Kerning, where the space between a specific pair of characters is adjusted using data in the font Kerning tables. #Method bool isDevKernText() const - -#In Full_Hinting_Spacing -#Line # returns true if Full_Hinting_Spacing is set ## - Returns if character spacing may be adjusted by the hinting difference. - - Equivalent to getFlags masked with kDevKernText_Flag. - - #Return kDevKernText_Flag state ## - - #Example - SkPaint paint; - SkDebugf("paint.isDevKernText() %c= !!(paint.getFlags() & SkPaint::kDevKernText_Flag)\n", - paint.isDevKernText() == !!(paint.getFlags() & SkPaint::kDevKernText_Flag) ? '=' : '!'); - paint.setDevKernText(true); - SkDebugf("paint.isDevKernText() %c= !!(paint.getFlags() & SkPaint::kDevKernText_Flag)\n", - paint.isDevKernText() == !!(paint.getFlags() & SkPaint::kDevKernText_Flag) ? '=' : '!'); - ## - +#Deprecated ## -#Method void setDevKernText(bool devKernText) - -#In Full_Hinting_Spacing -#Line # sets or clears Full_Hinting_Spacing ## - Requests, but does not require, to use hinting to adjust glyph spacing. - - Sets kDevKernText_Flag if devKernText is true. - Clears kDevKernText_Flag if devKernText is false. - - #Param devKernText setting for devKernText ## - - #Example - SkPaint paint1, paint2; - paint1.setDevKernText(true); - paint2.setFlags(paint2.getFlags() | SkPaint::kDevKernText_Flag); - SkDebugf("paint1 %c= paint2\n", paint1 == paint2 ? '=' : '!'); - - #StdOut - paint1 == paint2 - ## - ## - +#Method void setDevKernText(bool) +#Deprecated ## #Subtopic Full_Hinting_Spacing ## @@ -1599,7 +1562,7 @@ Filter_Quality is kNone_SkFilterQuality by default. void draw(SkCanvas* canvas) { SkPaint paint; canvas->scale(.2f, .2f); - for (SkFilterQuality q : { kNone_SkFilterQuality, kLow_SkFilterQuality, + for (SkFilterQuality q : { kNone_SkFilterQuality, kLow_SkFilterQuality, kMedium_SkFilterQuality, kHigh_SkFilterQuality } ) { paint.setFilterQuality(q); canvas->drawImage(image.get(), 0, 0, &paint); @@ -1616,7 +1579,7 @@ void draw(SkCanvas* canvas) { Returns Filter_Quality, the image filtering level. A lower setting draws faster; a higher setting looks better when the image is scaled. -#Return one of: kNone_SkFilterQuality, kLow_SkFilterQuality, +#Return one of: kNone_SkFilterQuality, kLow_SkFilterQuality, kMedium_SkFilterQuality, kHigh_SkFilterQuality #Return ## @@ -1639,9 +1602,9 @@ draws faster; a higher setting looks better when the image is scaled. #Line # sets Filter_Quality, the image filtering level ## Sets Filter_Quality, the image filtering level. A lower setting draws faster; a higher setting looks better when the image is scaled. -Does not check to see if quality is valid. +Does not check to see if quality is valid. -#Param quality one of: kNone_SkFilterQuality, kLow_SkFilterQuality, +#Param quality one of: kNone_SkFilterQuality, kLow_SkFilterQuality, kMedium_SkFilterQuality, kHigh_SkFilterQuality ## @@ -1737,10 +1700,10 @@ a different arrangement. #In Color_Methods #Line # sets Color_Alpha and Color_RGB, one drawing color ## Sets Alpha and Color_RGB used when stroking and filling. The color is a 32-bit value, - Unpremultiplied, packing 8-bit components for Alpha, Red, Blue, and Green. + Unpremultiplied, packing 8-bit components for Alpha, Red, Blue, and Green. #Param color Unpremultiplied Color_ARGB ## - + #Example SkPaint green1, green2; unsigned a = 255; @@ -1789,7 +1752,7 @@ Color_Alpha sets the transparency independent of Color_RGB: Color_RGB_Red, Color #In Alpha_Methods #Line # sets Color_Alpha, color opacity ## - Replaces Alpha, leaving Color_RGB + Replaces Alpha, leaving Color_RGB unchanged. An out of range value triggers an assert in the debug build. a is a value from zero to 255. a set to zero makes Color fully transparent; a set to 255 makes Color @@ -1823,7 +1786,7 @@ Color_Alpha sets the transparency independent of Color_RGB: Color_RGB_Red, Color #Param r amount of Color_RGB_Red, from no red (0) to full red (255) ## #Param g amount of Color_RGB_Green, from no green (0) to full green (255) ## #Param b amount of Color_RGB_Blue, from no blue (0) to full blue (255) ## - + #Example SkPaint transRed1, transRed2; transRed1.setARGB(255 / 2, 255, 0, 0); @@ -1875,8 +1838,8 @@ may have gaps, and if kAntiAlias_Flag is set, Color_Alpha will increase to visua #Alias Hairline # maybe should be Stroke_Hairline ? Stroke_Width of zero has a special meaning and switches drawing to use Hairline. -Hairline draws the thinnest continuous frame. If kAntiAlias_Flag is clear, adjacent pixels -flow horizontally, vertically,or diagonally. +Hairline draws the thinnest continuous frame. If kAntiAlias_Flag is clear, adjacent pixels +flow horizontally, vertically,or diagonally. #ToDo what is the description of Anti-aliased hairlines? ## @@ -1910,7 +1873,7 @@ a fill draw. #Const kFill_Style 0 Set to fill geometry. - Applies to Rect, Region, Round_Rect, Circles, Ovals, Path, and Text. + Applies to Rect, Region, Round_Rect, Circles, Ovals, Path, and Text. Bitmap, Image, Patches, Region, Sprites, and Vertices are painted as if kFill_Style is set, and ignore the set Style. The Path_Fill_Type specifies additional rules to fill the area outside the path edge, @@ -1920,7 +1883,7 @@ a fill draw. #Const kStroke_Style 1 Set to stroke geometry. - Applies to Rect, Region, Round_Rect, Arcs, Circles, Ovals, Path, and Text. + Applies to Rect, Region, Round_Rect, Arcs, Circles, Ovals, Path, and Text. Arcs, Lines, and points, are always drawn as if kStroke_Style is set, and ignore the set Style. The stroke construction is unaffected by the Path_Fill_Type. @@ -1930,7 +1893,7 @@ a fill draw. Set to stroke and fill geometry. Applies to Rect, Region, Round_Rect, Circles, Ovals, Path, and Text. Path is treated as if it is set to SkPath::kWinding_FillType, - and the set Path_Fill_Type is ignored. + and the set Path_Fill_Type is ignored. ## #Const kStyleCount 3 @@ -2011,12 +1974,12 @@ May be used to verify that Style is a legal value. #Line # thickness perpendicular to geometry ## Stroke_Width sets the width for stroking. The width is the thickness -of the stroke perpendicular to the path direction when the paint style is +of the stroke perpendicular to the path direction when the paint style is set to kStroke_Style or kStrokeAndFill_Style. When width is greater than zero, the stroke encompasses as many pixels partially or fully as needed. When the width equals zero, the paint enables hairlines; -the stroke is always one pixel wide. +the stroke is always one pixel wide. The stroke dimensions are scaled by the canvas matrix, but Hairline stroke remains one pixel wide regardless of scaling. @@ -2027,12 +1990,12 @@ The default width for the paint is zero. #Height 170 #Platform raster gpu #Description - The pixels hit to represent thin lines vary with the angle of the + The pixels hit to represent thin lines vary with the angle of the line and the platform implementation. ## void draw(SkCanvas* canvas) { SkPaint paint; - for (bool antialias : { false, true }) { + for (bool antialias : { false, true }) { paint.setAntiAlias(antialias); for (int width = 0; width <= 4; ++width) { SkScalar offset = antialias * 100 + width * 20; @@ -2052,7 +2015,7 @@ The default width for the paint is zero. outline the shape. #Return zero for Hairline, greater than zero for pen thickness ## - + #Example SkPaint paint; SkDebugf("0 %c= paint.getStrokeWidth()\n", 0 == paint.getStrokeWidth() ? '=' : '!'); @@ -2069,10 +2032,10 @@ The default width for the paint is zero. #In Stroke_Width #Line # sets thickness of the stroke ## Sets the thickness of the pen used by the paint to - outline the shape. - Has no effect if width is less than zero. + outline the shape. + Has no effect if width is less than zero. - #Param width zero thickness for Hairline; greater than zero for pen thickness + #Param width zero thickness for Hairline; greater than zero for pen thickness ## #Example @@ -2266,7 +2229,7 @@ Stroke_Cap draws at the beginning and end of an open Path_Contour. ## #Enum ## -Stroke describes the area covered by a pen of Stroke_Width as it +Stroke describes the area covered by a pen of Stroke_Width as it follows the Path_Contour, moving parallel to the contour direction. If the Path_Contour is not terminated by SkPath::kClose_Verb, the contour has a @@ -2275,7 +2238,7 @@ visible beginning and end. Path_Contour may start and end at the same point; defining Zero_Length_Contour. kButt_Cap and Zero_Length_Contour is not drawn. -kRound_Cap and Zero_Length_Contour draws a circle of diameter Stroke_Width +kRound_Cap and Zero_Length_Contour draws a circle of diameter Stroke_Width at the contour point. kSquare_Cap and Zero_Length_Contour draws an upright square with a side of Stroke_Width at the contour point. @@ -2328,7 +2291,7 @@ Stroke_Cap is kButt_Cap by default. #Param cap one of: kButt_Cap, kRound_Cap, kSquare_Cap; has no effect if cap is not valid - ## + ## #Example SkPaint paint; @@ -2336,7 +2299,7 @@ Stroke_Cap is kButt_Cap by default. paint.setStrokeCap((SkPaint::Cap) SkPaint::kCapCount); SkDebugf("kRound_Cap %c= paint.getStrokeCap()\n", SkPaint::kRound_Cap == paint.getStrokeCap() ? '=' : '!'); - + #StdOut kRound_Cap == paint.getStrokeCap() ## @@ -2352,7 +2315,7 @@ Stroke_Cap is kButt_Cap by default. Stroke_Join draws at the sharp corners of an open or closed Path_Contour. -Stroke describes the area covered by a pen of Stroke_Width as it +Stroke describes the area covered by a pen of Stroke_Width as it follows the Path_Contour, moving parallel to the contour direction. If the contour direction changes abruptly, because the tangent direction leading @@ -2398,7 +2361,7 @@ Choose miter join to draw sharp corners. Choose round join to draw a circle with radius equal to the stroke width on top of the corner. Choose bevel join to minimally connect the thick strokes. -The fill path constructed to describe the stroked path respects the join setting but may +The fill path constructed to describe the stroked path respects the join setting but may not contain the actual join. For instance, a fill path constructed with round joins does not necessarily include circles at each connected segment. @@ -2421,7 +2384,7 @@ not necessarily include circles at each connected segment. #Const kDefault_Join 1 Equivalent to kMiter_Join. - Stroke_Join is set to kMiter_Join by default. + Stroke_Join is set to kMiter_Join by default. ## #Const kJoinCount 3 @@ -2482,7 +2445,7 @@ void draw(SkCanvas* canvas) { The geometry drawn at the corners of strokes. #Param join one of: kMiter_Join, kRound_Join, kBevel_Join; - otherwise, has no effect + otherwise, has no effect ## #Example @@ -2516,11 +2479,11 @@ destination Path. Fill Path can request the Path_Effect to restrict to a culling rectangle, but the Path_Effect is not required to do so. -If Style is kStroke_Style or kStrokeAndFill_Style, +If Style is kStroke_Style or kStrokeAndFill_Style, and Stroke_Width is greater than zero, the Stroke_Width, Stroke_Cap, Stroke_Join, and Miter_Limit operate on the destination Path, replacing it. -Fill Path can specify the precision used by Stroke_Width to approximate the stroke geometry. +Fill Path can specify the precision used by Stroke_Width to approximate the stroke geometry. If the Style is kStroke_Style and the Stroke_Width is zero, getFillPath returns false since Hairline has no filled equivalent. @@ -2544,7 +2507,7 @@ returns false since Hairline has no filled equivalent. #Height 192 #Description A very small Quad stroke is turned into a filled path with increasing levels of precision. - At the lowest precision, the Quad stroke is approximated by a rectangle. + At the lowest precision, the Quad stroke is approximated by a rectangle. At the highest precision, the filled path has high fidelity compared to the original stroke. ## void draw(SkCanvas* canvas) { @@ -2615,7 +2578,7 @@ returns false since Hairline has no filled equivalent. Shader defines the colors used when drawing a shape. Shader may be an image, a gradient, or a computed fill. -If Paint has no Shader, then Color fills the shape. +If Paint has no Shader, then Color fills the shape. Shader is modulated by Color_Alpha component of Color. If Shader object defines only Color_Alpha, then Color modulated by Color_Alpha describes @@ -2648,7 +2611,7 @@ void draw(SkCanvas* canvas) { bitmap.setInfo(SkImageInfo::MakeA8(5, 1), 5); // bitmap only contains alpha uint8_t pixels[5] = { 0x22, 0x55, 0x88, 0xBB, 0xFF }; bitmap.setPixels(pixels); - paint.setShader(SkShader::MakeBitmapShader(bitmap, + paint.setShader(SkShader::MakeBitmapShader(bitmap, SkShader::kMirror_TileMode, SkShader::kMirror_TileMode)); for (SkColor c : { SK_ColorRED, SK_ColorBLUE, SK_ColorGREEN } ) { paint.setColor(c); // all components in color affect shader @@ -2665,7 +2628,7 @@ void draw(SkCanvas* canvas) { Optional colors used when filling a path, such as a gradient. Does not alter Shader Reference_Count. - + #Return Shader if previously set, nullptr otherwise ## #Example @@ -2769,7 +2732,7 @@ void draw(SkCanvas* canvas) { #Line # returns Color_Filter, how colors are altered ## Returns Color_Filter if set, or nullptr. Does not alter Color_Filter Reference_Count. - + #Return Color_Filter if previously set, nullptr otherwise ## #Example @@ -2876,10 +2839,10 @@ void draw(SkCanvas* canvas) { #Example void draw(SkCanvas* canvas) { SkPaint paint; - SkDebugf("kSrcOver %c= getBlendMode\n", + SkDebugf("kSrcOver %c= getBlendMode\n", SkBlendMode::kSrcOver == paint.getBlendMode() ? '=' : '!'); paint.setBlendMode(SkBlendMode::kSrc); - SkDebugf("kSrcOver %c= getBlendMode\n", + SkDebugf("kSrcOver %c= getBlendMode\n", SkBlendMode::kSrcOver == paint.getBlendMode() ? '=' : '!'); } @@ -2919,7 +2882,7 @@ void draw(SkCanvas* canvas) { #In Blend_Mode_Methods #Line # sets Blend_Mode, how colors combine with destination ## - Sets Blend_Mode to mode. + Sets Blend_Mode to mode. Does not check for valid input. #Param mode SkBlendMode used to combine source color and destination ## @@ -2969,7 +2932,7 @@ If Paint has no Path_Effect, the path geometry is unaltered when filled or strok #Line # returns Path_Effect, modifications to path geometry; dashing ## Returns Path_Effect if set, or nullptr. Does not alter Path_Effect Reference_Count. - + #Return Path_Effect if previously set, nullptr otherwise ## #Example @@ -3064,7 +3027,7 @@ modifying the draw. #Line # returns Mask_Filter, alterations to Mask_Alpha ## Returns Mask_Filter if set, or nullptr. Does not alter Mask_Filter Reference_Count. - + #Return Mask_Filter if previously set, nullptr otherwise ## #Example @@ -3090,7 +3053,7 @@ modifying the draw. Returns Mask_Filter if set, or nullptr. Increases Mask_Filter Reference_Count by one. - + #Return Mask_Filter if previously set, nullptr otherwise ## #Example @@ -3164,7 +3127,7 @@ implementation. #Line # returns Typeface, font description ## Returns Typeface if set, or nullptr. Increments Typeface Reference_Count by one. - + #Return Typeface if previously set, nullptr otherwise ## #Example @@ -3194,7 +3157,7 @@ implementation. #Example void draw(SkCanvas* canvas) { SkPaint paint1, paint2; - paint1.setTypeface(SkTypeface::MakeFromName("monospace", + paint1.setTypeface(SkTypeface::MakeFromName("monospace", SkFontStyle(SkFontStyle::kNormal_Weight, SkFontStyle::kNormal_Width, SkFontStyle::kItalic_Slant))); SkDebugf("typeface1 %c= typeface2\n", @@ -3216,7 +3179,7 @@ implementation. #In Typeface_Methods #Line # sets Typeface, font description ## -Sets Typeface to typeface, decreasing Reference_Count of the previous Typeface. +Sets Typeface to typeface, decreasing Reference_Count of the previous Typeface. Pass nullptr to clear Typeface and use the default typeface. Increments typeface Reference_Count by one. @@ -3273,7 +3236,7 @@ Mask_Filter. #Line # returns Image_Filter, alter pixels; blur ## Returns Image_Filter if set, or nullptr. Does not alter Image_Filter Reference_Count. - + #Return Image_Filter if previously set, nullptr otherwise ## #Example @@ -3361,7 +3324,7 @@ to another to construct the draw. Draw_Looper draws one or more times, modifying the canvas and paint each time. Draw_Looper may be used to draw multiple colors or create a colored shadow. -Set Draw_Looper to nullptr to prevent Draw_Looper from modifying the draw. +Set Draw_Looper to nullptr to prevent Draw_Looper from modifying the draw. #Example #Height 128 @@ -3388,7 +3351,7 @@ Set Draw_Looper to nullptr to prevent Draw_Looper from modifying the draw. #Line # returns Draw_Looper, multiple layers ## Returns Draw_Looper if set, or nullptr. Does not alter Draw_Looper Reference_Count. - + #Return Draw_Looper if previously set, nullptr otherwise ## #Example @@ -3491,9 +3454,9 @@ Increments drawLooper Reference_Count by one. Align adjusts the text relative to the text position. Align affects Glyphs drawn with: SkCanvas::drawText, SkCanvas::drawPosText, -SkCanvas::drawPosTextH, SkCanvas::drawTextOnPath, +SkCanvas::drawPosTextH, SkCanvas::drawTextOnPath, SkCanvas::drawTextOnPathHV, SkCanvas::drawTextRSXform, SkCanvas::drawTextBlob, -and SkCanvas::drawString; +and SkCanvas::drawString; as well as calls that place text Glyphs like getTextWidths and getTextPath. The text position is set by the font for both horizontal and vertical text. @@ -3501,7 +3464,7 @@ Typically, for horizontal text, the position is to the left side of the glyph on base line; and for vertical text, the position is the horizontal center of the glyph at the caps height. -Align adjusts the glyph position to center it or move it to abut the position +Align adjusts the glyph position to center it or move it to abut the position using the metrics returned by the font. Align defaults to kLeft_Align. @@ -3654,7 +3617,7 @@ Set SkPaintDefaults_TextSize at compile time to change the default setting. #Line # sets text size in points ## Sets Text_Size in points. Has no effect if textSize is not greater than or equal to zero. - + #Param textSize typographic height of text ## #Example @@ -3715,7 +3678,7 @@ Text_Scale_X defaults to 1. #Line # sets the text horizontal scale; condensed text ## Sets Text_Scale_X. Default value is 1. - + #Param scaleX text horizontal scale ## #Example @@ -3822,7 +3785,7 @@ in the total storage required. #A UTF-32 # http://www.unicode.org/versions/Unicode5.0.0/ch03.pdf ## encodes each character as one 32-bit word. -Font_Manager uses font data to convert character code points into glyph indices. +Font_Manager uses font data to convert character code points into glyph indices. A glyph index is a 16-bit word. TextEncoding is set to kUTF8_TextEncoding by default. @@ -3875,16 +3838,16 @@ void draw(SkCanvas* canvas) { Returns Text_Encoding. Text_Encoding determines how character code points are mapped to font glyph indices. - #Return one of: kUTF8_TextEncoding, kUTF16_TextEncoding, kUTF32_TextEncoding, or - kGlyphID_TextEncoding + #Return one of: kUTF8_TextEncoding, kUTF16_TextEncoding, kUTF32_TextEncoding, or + kGlyphID_TextEncoding ## #Example SkPaint paint; - SkDebugf("kUTF8_TextEncoding %c= text encoding\n", + SkDebugf("kUTF8_TextEncoding %c= text encoding\n", SkPaint::kUTF8_TextEncoding == paint.getTextEncoding() ? '=' : '!'); paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); - SkDebugf("kGlyphID_TextEncoding %c= text encoding\n", + SkDebugf("kGlyphID_TextEncoding %c= text encoding\n", SkPaint::kGlyphID_TextEncoding == paint.getTextEncoding() ? '=' : '!'); #StdOut @@ -3900,12 +3863,12 @@ void draw(SkCanvas* canvas) { #In Text_Encoding #Line # sets character or glyph encoded size ## - Sets Text_Encoding to encoding. + Sets Text_Encoding to encoding. Text_Encoding determines how character code points are mapped to font glyph indices. Invalid values for encoding are ignored. - #Param encoding one of: kUTF8_TextEncoding, kUTF16_TextEncoding, kUTF32_TextEncoding, or - kGlyphID_TextEncoding + #Param encoding one of: kUTF8_TextEncoding, kUTF16_TextEncoding, kUTF32_TextEncoding, or + kGlyphID_TextEncoding #Param ## #Example @@ -3926,7 +3889,7 @@ void draw(SkCanvas* canvas) { #Line # common glyph dimensions ## Font_Metrics describe dimensions common to the Glyphs in Typeface. -The dimensions are computed by Font_Manager from font data and do not take +The dimensions are computed by Font_Manager from font data and do not take Paint settings other than Text_Size into account. Font dimensions specify the anchor to the left of the glyph at baseline as the origin. @@ -4279,12 +4242,12 @@ void draw(SkCanvas* canvas) { #In Font_Metrics #Line # returns union all glyph bounds ## Returns the union of bounds of all Glyphs. -Returned dimensions are computed by Font_Manager from font data, +Returned dimensions are computed by Font_Manager from font data, ignoring Hinting. Includes Text_Size, Text_Scale_X, and Text_Skew_X, but not Fake_Bold or Path_Effect. If Text_Size is large, Text_Scale_X is one, and Text_Skew_X is zero, -returns the same bounds as Font_Metrics { FontMetrics::fXMin, +returns the same bounds as Font_Metrics { FontMetrics::fXMin, FontMetrics::fTop, FontMetrics::fXMax, FontMetrics::fBottom }. #Return union of bounds of all Glyphs ## @@ -4377,7 +4340,7 @@ text contains an invalid UTF-8 sequence, zero is returned. #Method bool containsText(const void* text, size_t byteLength) const #In Utility #Line # returns if all text corresponds to Glyphs ## - Returns true if all text corresponds to a non-zero glyph index. + Returns true if all text corresponds to a non-zero glyph index. Returns false if any characters in text are not supported in Typeface. @@ -4401,7 +4364,7 @@ text contains an invalid UTF-8 sequence, zero is returned. const uint16_t goodChar = 0x00B0; // degree symbol const uint16_t badChar = 0xD800; // Unicode surrogate paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); - SkDebugf("0x%04x %c= has char\n", goodChar, + SkDebugf("0x%04x %c= has char\n", goodChar, paint.containsText(&goodChar, 2) ? '=' : '!'); SkDebugf("0x%04x %c= has char\n", badChar, paint.containsText(&badChar, 2) ? '=' : '!'); @@ -4422,7 +4385,7 @@ text contains an invalid UTF-8 sequence, zero is returned. const uint16_t zeroGlyph = 0; const uint16_t badGlyph = 65535; // larger than glyph count in font paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); - SkDebugf("0x%04x %c= has glyph\n", goodGlyph, + SkDebugf("0x%04x %c= has glyph\n", goodGlyph, paint.containsText(&goodGlyph, 2) ? '=' : '!'); SkDebugf("0x%04x %c= has glyph\n", zeroGlyph, paint.containsText(&zeroGlyph, 2) ? '=' : '!'); @@ -4447,8 +4410,8 @@ text contains an invalid UTF-8 sequence, zero is returned. #In Utility #Line # converts Glyphs into text ## - Converts glyphs into text if possible. - Glyph values without direct Unicode equivalents are mapped to zero. + Converts glyphs into text if possible. + Glyph values without direct Unicode equivalents are mapped to zero. Uses the Typeface, but is unaffected by Text_Encoding; the text values returned are equivalent to kUTF32_TextEncoding. @@ -4496,7 +4459,7 @@ text contains an invalid UTF-8 sequence, zero is returned. Path_Effect to scale the metrics and bounds. Returns the bounding box of text if bounds is not nullptr. The bounding box is computed as if the text was drawn at the origin. - + #Param text character codes or glyph indices to be measured ## #Param length number of bytes of text to measure ## #Param bounds returns bounding box relative to (0, 0) if not nullptr ## @@ -4572,7 +4535,7 @@ text contains an invalid UTF-8 sequence, zero is returned. #Param maxWidth advance limit; text is measured while advance is less than maxWidth ## #Param measuredWidth returns the width of the text less than or equal to maxWidth ## #Return bytes of text that fit, always less than or equal to length ## - + #Example #Description Line under "Breakfast" shows desired width, shorter than available characters. @@ -4606,19 +4569,19 @@ text contains an invalid UTF-8 sequence, zero is returned. the glyph count in text. Both widths and bounds may be nullptr. If widths is not nullptr, widths must be an array of glyph count entries. - if bounds is not nullptr, bounds must be an array of glyph count entries. + if bounds is not nullptr, bounds must be an array of glyph count entries. If kVerticalText_Flag is clear, widths returns the horizontal advance. If kVerticalText_Flag is set, widths returns the vertical advance. Uses Text_Encoding to decode text, Typeface to get the font metrics, and Text_Size to scale the widths and bounds. Does not scale the advance by Fake_Bold or Path_Effect. Does include Fake_Bold and Path_Effect in the bounds. - + #Param text character codes or glyph indices to be measured ## #Param byteLength number of bytes of text to measure ## #Param widths returns text advances for each glyph; may be nullptr ## #Param bounds returns bounds for each glyph relative to (0, 0); may be nullptr ## - + #Return glyph count in text ## #Example @@ -4758,13 +4721,13 @@ underline that skips Descenders. Returns the number of intervals that intersect bounds. bounds describes a pair of lines parallel to the text advance. The return count is zero or a multiple of two, and is at most twice the number of Glyphs in - the string. + the string. Uses Text_Encoding to decode text, Typeface to get the glyph paths, and Text_Size, Fake_Bold, and Path_Effect to scale and modify the glyph paths. Uses x, y, and Text_Align to position intervals. - + Pass nullptr for intervals to determine the size of the interval array. - + intervals are cached to improve performance for multiple calls. #Param text character codes or glyph indices ## @@ -4813,13 +4776,13 @@ void draw(SkCanvas* canvas) { Returns the number of intervals that intersect bounds. bounds describes a pair of lines parallel to the text advance. The return count is zero or a multiple of two, and is at most twice the number of Glyphs in - the string. + the string. Uses Text_Encoding to decode text, Typeface to get the glyph paths, and Text_Size, Fake_Bold, and Path_Effect to scale and modify the glyph paths. Uses pos array and Text_Align to position intervals. - + Pass nullptr for intervals to determine the size of the interval array. - + intervals are cached to improve performance for multiple calls. #Param text character codes or glyph indices ## @@ -4868,13 +4831,13 @@ void draw(SkCanvas* canvas) { Returns the number of intervals that intersect bounds. bounds describes a pair of lines parallel to the text advance. The return count is zero or a multiple of two, and is at most twice the number of Glyphs in - the string. + the string. Uses Text_Encoding to decode text, Typeface to get the glyph paths, and Text_Size, Fake_Bold, and Path_Effect to scale and modify the glyph paths. Uses xpos array, constY, and Text_Align to position intervals. - + Pass nullptr for intervals to determine the size of the interval array. - + intervals are cached to improve performance for multiple calls. #Param text character codes or glyph indices ## @@ -4928,15 +4891,15 @@ void draw(SkCanvas* canvas) { Returns the number of intervals that intersect bounds. bounds describes a pair of lines parallel to the text advance. The return count is zero or a multiple of two, and is at most twice the number of Glyphs in - the string. + the string. Uses Typeface to get the glyph paths, and Text_Size, Fake_Bold, and Path_Effect to scale and modify the glyph paths. Uses run array and Text_Align to position intervals. - + Text_Encoding must be set to SkPaint::kGlyphID_TextEncoding. Pass nullptr for intervals to determine the size of the interval array. - + intervals are cached to improve performance for multiple calls. #Param blob Glyphs, positions, and text paint attributes ## @@ -4954,11 +4917,11 @@ void draw(SkCanvas* canvas) { SkPoint textPos = { 20, 110 }; int len = 3; SkTextBlobBuilder textBlobBuilder; - const SkTextBlobBuilder::RunBuffer& run = + const SkTextBlobBuilder::RunBuffer& run = textBlobBuilder.allocRun(paint, len, textPos.fX, textPos.fY); run.glyphs[0] = 10; run.glyphs[1] = 20; - run.glyphs[2] = 30; + run.glyphs[2] = 30; sk_sp blob = textBlobBuilder.make(); canvas->drawTextBlob(blob.get(), textPos.fX, textPos.fY, paint); SkScalar bounds[] = { 116, 134 }; @@ -4996,7 +4959,7 @@ void draw(SkCanvas* canvas) { #Example void draw(SkCanvas* canvas) { auto debugster = [](const char* prefix, const SkPaint& p) -> void { - SkDebugf("%s nothing to draw: %s\n", prefix, + SkDebugf("%s nothing to draw: %s\n", prefix, p.nothingToDraw() ? "true" : "false"); }; SkPaint paint; @@ -5022,18 +4985,18 @@ void draw(SkCanvas* canvas) { # ------------------------------------------------------------------------------ #Subtopic Fast_Bounds #Line # approximate area required by Paint ## - #Private - To be made private. + #Private + To be made private. ## Fast_Bounds methods conservatively outset a drawing bounds by additional area Paint may draw to. #Method bool canComputeFastBounds() const - + #In Fast_Bounds #Line # returns true if settings allow for fast bounds computation ## - #Private + #Private (to be made private) ## @@ -5045,10 +5008,10 @@ Paint may draw to. ## #Method const SkRect& computeFastBounds(const SkRect& orig, SkRect* storage) const - + #In Fast_Bounds #Line # returns fill bounds for quick reject tests ## - #Private + #Private (to be made private) ## @@ -5063,7 +5026,7 @@ Paint may draw to. use the returned value. It is legal for orig and storage to be the same Rect. - #Private + #Private e.g. if (paint.canComputeFastBounds()) { SkRect r, storage; @@ -5085,7 +5048,7 @@ Paint may draw to. SkRect* storage) const #In Fast_Bounds #Line # returns stroke bounds for quick reject tests ## - #Private + #Private (to be made private) ## @@ -5099,7 +5062,7 @@ Paint may draw to. Style style) const #In Fast_Bounds #Line # returns bounds for quick reject tests ## - #Private + #Private (to be made private) ## diff --git a/gn/core.gni b/gn/core.gni index d396105c88..cb7f63d3de 100644 --- a/gn/core.gni +++ b/gn/core.gni @@ -20,7 +20,6 @@ skia_core_sources = [ "$_src/core/SkAntiRun.h", "$_src/core/SkATrace.cpp", "$_src/core/SkATrace.h", - "$_src/core/SkAutoKern.h", "$_src/core/SkAutoPixmapStorage.h", "$_src/core/SkAutoPixmapStorage.cpp", "$_src/core/SkBBHFactory.cpp", diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h index 7a65e2ca47..a564824448 100644 --- a/include/core/SkPaint.h +++ b/include/core/SkPaint.h @@ -451,9 +451,7 @@ public: @return kDevKernText_Flag state */ - bool isDevKernText() const { - return SkToBool(this->getFlags() & kDevKernText_Flag); - } + bool isDevKernText() const { return false; } /** Requests, but does not require, to use hinting to adjust glyph spacing. @@ -462,7 +460,7 @@ public: @param devKernText setting for devKernText */ - void setDevKernText(bool devKernText); + void setDevKernText(bool) { } /** Returns SkFilterQuality, the image filtering level. A lower setting draws faster; a higher setting looks better when the image is scaled. @@ -1645,7 +1643,6 @@ private: }; static GlyphCacheProc GetGlyphCacheProc(TextEncoding encoding, - bool isDevKern, bool needFullMetrics); SkScalar measure_text(SkGlyphCache*, const char* text, size_t length, diff --git a/samplecode/SampleText.cpp b/samplecode/SampleText.cpp index bb3507ef41..1b67103ffd 100644 --- a/samplecode/SampleText.cpp +++ b/samplecode/SampleText.cpp @@ -92,8 +92,7 @@ protected: SkPaint paint; const char* s = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit"; - paint.setFlags(paint.getFlags() | SkPaint::kAntiAlias_Flag - | SkPaint::kDevKernText_Flag); + paint.setFlags(paint.getFlags() | SkPaint::kAntiAlias_Flag); paint.setTextSize(SkIntToScalar(14)); canvas.drawString(s, SkIntToScalar(8), SkIntToScalar(14), paint); } diff --git a/src/core/SkAutoKern.h b/src/core/SkAutoKern.h deleted file mode 100644 index 8b032519b3..0000000000 --- a/src/core/SkAutoKern.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - -#ifndef SkAutoKern_DEFINED -#define SkAutoKern_DEFINED - -#include "SkGlyph.h" - -#define SkAutoKern_Adjust(prev, next) SkIntToScalar(((next) - (prev) + 32) >> 6) - -/* this is a helper class to perform auto-kerning - * the adjust() method returns a SkScalar corresponding - * to a +1/0/-1 pixel adjustment - */ - -class SkAutoKern { -public: - SkAutoKern() : fPrevRsbDelta(0) {} - - SkScalar adjust(const SkGlyph& glyph) - { -// if (SkAbs32(glyph.fLsbDelta) > 47 || SkAbs32(glyph.fRsbDelta) > 47) -// printf("------- %d> L %d R %d\n", glyph.f_GlyphID, glyph.fLsbDelta, glyph.fRsbDelta); - -#if 0 - int distort = fPrevRsbDelta - glyph.fLsbDelta; - - fPrevRsbDelta = glyph.fRsbDelta; - - if (distort >= 32) - return -SK_Scalar1; - else if (distort < -32) - return +SK_Scalar1; - else - return 0; -#else - SkScalar adjust = SkAutoKern_Adjust(fPrevRsbDelta, glyph.fLsbDelta); - fPrevRsbDelta = glyph.fRsbDelta; - return adjust; -#endif - } -private: - int fPrevRsbDelta; -}; - -#endif diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index e3c81ba258..0526f76f8e 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp @@ -1571,7 +1571,6 @@ void SkDraw::drawPosText_asPaths(const char text[], size_t byteLength, const SkS paint.setPathEffect(nullptr); SkPaint::GlyphCacheProc glyphCacheProc = SkPaint::GetGlyphCacheProc(paint.getTextEncoding(), - paint.isDevKernText(), true); auto cache = SkStrikeCache::FindOrCreateStrikeExclusive( paint, props, this->scalerContextFlags(), nullptr); diff --git a/src/core/SkFindAndPlaceGlyph.h b/src/core/SkFindAndPlaceGlyph.h index d92edb6b17..00417152ab 100644 --- a/src/core/SkFindAndPlaceGlyph.h +++ b/src/core/SkFindAndPlaceGlyph.h @@ -9,7 +9,6 @@ #define SkFindAndPositionGlyph_DEFINED #include "SkArenaAlloc.h" -#include "SkAutoKern.h" #include "SkGlyph.h" #include "SkGlyphCache.h" #include "SkMatrixPriv.h" @@ -320,8 +319,8 @@ private: virtual ~GlyphFindAndPlaceInterface() { } // findAndPositionGlyph calculates the position of the glyph, finds the glyph, and - // returns the position of where the next glyph will be using the glyph's advance and - // possibly kerning. The returned position is used by drawText, but ignored by drawPosText. + // returns the position of where the next glyph will be using the glyph's advance. The + // returned position is used by drawText, but ignored by drawPosText. // The compiler should prune all this calculation if the return value is not used. // // This should be a pure virtual, but some versions of GCC <= 4.8 have a bug that causes a @@ -383,31 +382,20 @@ private: GlyphFinderInterface* fGlyphFinder; }; - enum SelectKerning { - kNoKerning = false, - kUseKerning = true - }; - // GlyphFindAndPlaceFullPixel handles finding and placing glyphs when no sub-pixel - // positioning is requested. The kUseKerning argument should be true for drawText, and false - // for drawPosText. - template + // positioning is requested. + template class GlyphFindAndPlaceFullPixel final : public GlyphFindAndPlaceInterface { public: explicit GlyphFindAndPlaceFullPixel(GlyphFinderInterface* glyphFinder) : fGlyphFinder(glyphFinder) { - // Kerning can only be used with SkPaint::kLeft_Align - static_assert(!kUseKerning || SkPaint::kLeft_Align == kTextAlignment, - "Kerning can only be used with left aligned text."); } SkPoint findAndPositionGlyph( const char** text, SkPoint position, ProcessOneGlyph&& processOneGlyph) override { SkPoint finalPosition = position; const SkGlyph& glyph = fGlyphFinder->lookupGlyph(text); - if (kUseKerning) { - finalPosition += {fAutoKern.adjust(glyph), 0.0f}; - } + if (glyph.fWidth > 0) { finalPosition -= TextAlignmentAdjustment(kTextAlignment, glyph); processOneGlyph(glyph, finalPosition, {SK_ScalarHalf, SK_ScalarHalf}); @@ -418,8 +406,6 @@ private: private: GlyphFinderInterface* fGlyphFinder; - - SkAutoKern fAutoKern; }; template @@ -446,14 +432,12 @@ private: SkScalar x = 0, y = 0; const char* stop = text + byteLength; - SkAutoKern autokern; - while (text < stop) { // don't need x, y here, since all subpixel variants will have the // same advance const SkGlyph& glyph = glyphFinder->lookupGlyph(&text); - x += autokern.adjust(glyph) + SkFloatToScalar(glyph.fAdvanceX); + x += SkFloatToScalar(glyph.fAdvanceX); y += SkFloatToScalar(glyph.fAdvanceY); } SkASSERT(text == stop); @@ -543,18 +527,17 @@ inline void SkFindAndPlaceGlyph::ProcessPosText( switch (textAlignment) { case SkPaint::kLeft_Align: findAndPosition = arena.make< - GlyphFindAndPlaceFullPixel>(glyphFinder); + GlyphFindAndPlaceFullPixel>(glyphFinder); break; case SkPaint::kCenter_Align: findAndPosition = arena.make< GlyphFindAndPlaceFullPixel>(glyphFinder); + SkPaint::kCenter_Align>>(glyphFinder); break; case SkPaint::kRight_Align: findAndPosition = arena.make< GlyphFindAndPlaceFullPixel>(glyphFinder); + SkPaint::kRight_Align>>(glyphFinder); break; } } @@ -595,8 +578,7 @@ inline void SkFindAndPlaceGlyph::ProcessText( findAndPosition = getSubpixel( &arena, axisAlignment, glyphFinder); } else { - using FullPixel = - GlyphFindAndPlaceFullPixel; + using FullPixel = GlyphFindAndPlaceFullPixel; findAndPosition = arena.make(glyphFinder); } diff --git a/src/core/SkGlyph.cpp b/src/core/SkGlyph.cpp index 2abe98aa1e..33246cc2dc 100644 --- a/src/core/SkGlyph.cpp +++ b/src/core/SkGlyph.cpp @@ -31,8 +31,6 @@ void SkGlyph::zeroMetrics() { fHeight = 0; fTop = 0; fLeft = 0; - fRsbDelta = 0; - fLsbDelta = 0; } static size_t bits_to_bytes(size_t bits) { diff --git a/src/core/SkGlyph.h b/src/core/SkGlyph.h index 211039e520..87cd852bd8 100644 --- a/src/core/SkGlyph.h +++ b/src/core/SkGlyph.h @@ -131,7 +131,6 @@ struct SkPackedUnicharID : public SkPackedID { } }; -SK_BEGIN_REQUIRE_DENSE class SkGlyph { // Support horizontal and vertical skipping strike-through / underlines. // The caller walks the linked list looking for a match. For a horizontal underline, @@ -159,7 +158,9 @@ public: int16_t fTop, fLeft; uint8_t fMaskFormat; +#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK int8_t fRsbDelta, fLsbDelta; // used by auto-kerning +#endif int8_t fForceBW; void initWithGlyphID(SkPackedGlyphID glyph_id); @@ -224,6 +225,5 @@ public: #endif SkPackedGlyphID fID; }; -SK_END_REQUIRE_DENSE #endif diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index 141b60b252..ab3e2da9b5 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -7,7 +7,6 @@ #include "SkPaint.h" #include "SkPaintPriv.h" -#include "SkAutoKern.h" #include "SkColorFilter.h" #include "SkData.h" #include "SkDraw.h" @@ -245,10 +244,6 @@ void SkPaint::setFakeBoldText(bool doFakeBold) { this->setFlags(set_clear_mask(fBitfields.fFlags, doFakeBold, kFakeBoldText_Flag)); } -void SkPaint::setDevKernText(bool doDevKern) { - this->setFlags(set_clear_mask(fBitfields.fFlags, doDevKern, kDevKernText_Flag)); -} - void SkPaint::setStyle(Style style) { if ((unsigned)style < kStyleCount) { fBitfields.fStyle = style; @@ -625,8 +620,7 @@ static const SkGlyph& sk_getAdvance_glyph_next(SkGlyphCache* cache, } SkPaint::GlyphCacheProc SkPaint::GetGlyphCacheProc(TextEncoding encoding, - bool isDevKern, - bool needFullMetrics) { + bool needFullMetrics) { static const GlyphCacheProc gGlyphCacheProcs[] = { sk_getMetrics_utf8_next, sk_getMetrics_utf16_next, @@ -641,7 +635,7 @@ SkPaint::GlyphCacheProc SkPaint::GetGlyphCacheProc(TextEncoding encoding, unsigned index = encoding; - if (!needFullMetrics && !isDevKern) { + if (!needFullMetrics) { index += 4; } @@ -652,7 +646,6 @@ SkPaint::GlyphCacheProc SkPaint::GetGlyphCacheProc(TextEncoding encoding, /////////////////////////////////////////////////////////////////////////////// #define TEXT_AS_PATHS_PAINT_FLAGS_TO_IGNORE ( \ -SkPaint::kDevKernText_Flag | \ SkPaint::kLinearText_Flag | \ SkPaint::kLCDRenderText_Flag | \ SkPaint::kEmbeddedBitmapText_Flag | \ @@ -739,7 +732,6 @@ SkScalar SkPaint::measure_text(SkGlyphCache* cache, } GlyphCacheProc glyphCacheProc = SkPaint::GetGlyphCacheProc(this->getTextEncoding(), - this->isDevKernText(), nullptr != bounds); int xyIndex; @@ -758,33 +750,16 @@ SkScalar SkPaint::measure_text(SkGlyphCache* cache, SkScalar x = advance(*g, xyIndex); if (nullptr == bounds) { - if (this->isDevKernText()) { - for (; text < stop; n++) { - const int rsb = g->fRsbDelta; - g = &glyphCacheProc(cache, &text); - x += SkAutoKern_Adjust(rsb, g->fLsbDelta) + advance(*g, xyIndex); - } - } else { - for (; text < stop; n++) { - x += advance(glyphCacheProc(cache, &text), xyIndex); - } + for (; text < stop; n++) { + x += advance(glyphCacheProc(cache, &text), xyIndex); } } else { set_bounds(*g, bounds); - if (this->isDevKernText()) { - for (; text < stop; n++) { - const int rsb = g->fRsbDelta; - g = &glyphCacheProc(cache, &text); - x += SkAutoKern_Adjust(rsb, g->fLsbDelta); - joinBoundsProc(*g, bounds, x); - x += advance(*g, xyIndex); - } - } else { - for (; text < stop; n++) { - g = &glyphCacheProc(cache, &text); - joinBoundsProc(*g, bounds, x); - x += advance(*g, xyIndex); - } + + for (; text < stop; n++) { + g = &glyphCacheProc(cache, &text); + joinBoundsProc(*g, bounds, x); + x += advance(*g, xyIndex); } } SkASSERT(text == stop); @@ -857,33 +832,17 @@ size_t SkPaint::breakText(const void* textD, size_t length, SkScalar maxWidth, auto cache = SkStrikeCache::FindOrCreateStrikeExclusive(paint); GlyphCacheProc glyphCacheProc = SkPaint::GetGlyphCacheProc(paint.getTextEncoding(), - paint.isDevKernText(), false); const int xyIndex = paint.isVerticalText() ? 1 : 0; SkScalar width = 0; - if (this->isDevKernText()) { - int rsb = 0; - while (text < stop) { - const char* curr = text; - const SkGlyph& g = glyphCacheProc(cache.get(), &text); - SkScalar x = SkAutoKern_Adjust(rsb, g.fLsbDelta) + advance(g, xyIndex); - if ((width += x) > maxWidth) { - width -= x; - text = curr; - break; - } - rsb = g.fRsbDelta; - } - } else { - while (text < stop) { - const char* curr = text; - SkScalar x = advance(glyphCacheProc(cache.get(), &text), xyIndex); - if ((width += x) > maxWidth) { - width -= x; - text = curr; - break; - } + while (text < stop) { + const char* curr = text; + SkScalar x = advance(glyphCacheProc(cache.get(), &text), xyIndex); + if ((width += x) > maxWidth) { + width -= x; + text = curr; + break; } } @@ -961,7 +920,6 @@ int SkPaint::getTextWidths(const void* textData, size_t byteLength, auto cache = SkStrikeCache::FindOrCreateStrikeExclusive(paint); GlyphCacheProc glyphCacheProc = SkPaint::GetGlyphCacheProc(paint.getTextEncoding(), - paint.isDevKernText(), nullptr != bounds); const char* text = (const char*)textData; @@ -969,73 +927,27 @@ int SkPaint::getTextWidths(const void* textData, size_t byteLength, int count = 0; const int xyIndex = paint.isVerticalText() ? 1 : 0; - if (this->isDevKernText()) { - // we adjust the widths returned here through auto-kerning - SkAutoKern autokern; - SkScalar prevWidth = 0; - - if (scale) { - while (text < stop) { - const SkGlyph& g = glyphCacheProc(cache.get(), &text); - if (widths) { - SkScalar adjust = autokern.adjust(g); - - if (count > 0) { - *widths++ = (prevWidth + adjust) * scale; - } - prevWidth = advance(g, xyIndex); - } - if (bounds) { - set_bounds(g, bounds++, scale); - } - ++count; - } - if (count > 0 && widths) { - *widths = prevWidth * scale; - } - } else { - while (text < stop) { - const SkGlyph& g = glyphCacheProc(cache.get(), &text); - if (widths) { - SkScalar adjust = autokern.adjust(g); - - if (count > 0) { - *widths++ = prevWidth + adjust; - } - prevWidth = advance(g, xyIndex); - } - if (bounds) { - set_bounds(g, bounds++); - } - ++count; + if (scale) { + while (text < stop) { + const SkGlyph& g = glyphCacheProc(cache.get(), &text); + if (widths) { + *widths++ = advance(g, xyIndex) * scale; } - if (count > 0 && widths) { - *widths = prevWidth; + if (bounds) { + set_bounds(g, bounds++, scale); } + ++count; } - } else { // no devkern - if (scale) { - while (text < stop) { - const SkGlyph& g = glyphCacheProc(cache.get(), &text); - if (widths) { - *widths++ = advance(g, xyIndex) * scale; - } - if (bounds) { - set_bounds(g, bounds++, scale); - } - ++count; + } else { + while (text < stop) { + const SkGlyph& g = glyphCacheProc(cache.get(), &text); + if (widths) { + *widths++ = advance(g, xyIndex); } - } else { - while (text < stop) { - const SkGlyph& g = glyphCacheProc(cache.get(), &text); - if (widths) { - *widths++ = advance(g, xyIndex); - } - if (bounds) { - set_bounds(g, bounds++); - } - ++count; + if (bounds) { + set_bounds(g, bounds++); } + ++count; } } @@ -1649,7 +1561,6 @@ void SkPaint::toString(SkString* str) const { SkAddFlagToString(str, this->isFakeBoldText(), "FakeBoldText", &needSeparator); SkAddFlagToString(str, this->isLinearText(), "LinearText", &needSeparator); SkAddFlagToString(str, this->isSubpixelText(), "SubpixelText", &needSeparator); - SkAddFlagToString(str, this->isDevKernText(), "DevKernText", &needSeparator); SkAddFlagToString(str, this->isLCDRenderText(), "LCDRenderText", &needSeparator); SkAddFlagToString(str, this->isEmbeddedBitmapText(), "EmbeddedBitmapText", &needSeparator); @@ -1709,9 +1620,7 @@ SkTextBaseIter::SkTextBaseIter(const char text[], size_t length, const SkPaint& paint, bool applyStrokeAndPathEffects) : fPaint(paint) { - fGlyphCacheProc = SkPaint::GetGlyphCacheProc(paint.getTextEncoding(), - paint.isDevKernText(), - true); + fGlyphCacheProc = SkPaint::GetGlyphCacheProc(paint.getTextEncoding(), true); fPaint.setLinearText(true); fPaint.setMaskFilter(nullptr); // don't want this affecting our path-cache lookup @@ -1780,7 +1689,7 @@ bool SkTextToPathIter::next(const SkPath** path, SkScalar* xpos) { if (fText < fStop) { const SkGlyph& glyph = fGlyphCacheProc(fCache.get(), &fText); - fXPos += (fPrevAdvance + fAutoKern.adjust(glyph)) * fScale; + fXPos += fPrevAdvance * fScale; fPrevAdvance = advance(glyph, fXYIndex); // + fPaint.getTextTracking(); if (glyph.fWidth) { @@ -1802,7 +1711,7 @@ bool SkTextToPathIter::next(const SkPath** path, SkScalar* xpos) { bool SkTextInterceptsIter::next(SkScalar* array, int* count) { const SkGlyph& glyph = fGlyphCacheProc(fCache.get(), &fText); - fXPos += (fPrevAdvance + fAutoKern.adjust(glyph)) * fScale; + fXPos += fPrevAdvance * fScale; fPrevAdvance = advance(glyph, fXYIndex); // + fPaint.getTextTracking(); if (fCache->findPath(glyph)) { fCache->findIntercepts(fBounds, fScale, fXPos, SkToBool(fXYIndex), diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp index b8cd107bd3..57d8bc1ddf 100644 --- a/src/core/SkScalerContext.cpp +++ b/src/core/SkScalerContext.cpp @@ -106,15 +106,6 @@ void SkScalerContext::getMetrics(SkGlyph* glyph) { } } - // for now we have separate cache entries for devkerning on and off - // in the future we might share caches, but make our measure/draw - // code make the distinction. Thus we zap the values if the caller - // has not asked for them. - if ((fRec.fFlags & SkScalerContext::kDevKernText_Flag) == 0) { - // no devkern, so zap the fields - glyph->fLsbDelta = glyph->fRsbDelta = 0; - } - // if either dimension is empty, zap the image bounds of the glyph if (0 == glyph->fWidth || 0 == glyph->fHeight) { glyph->fWidth = 0; @@ -162,8 +153,6 @@ SK_ERROR: glyph->fTop = 0; glyph->fWidth = 0; glyph->fHeight = 0; - glyph->fLsbDelta = 0; - glyph->fRsbDelta = 0; // put a valid value here, in case it was earlier set to // MASK_FORMAT_JUST_ADVANCE glyph->fMaskFormat = fRec.fMaskFormat; @@ -885,10 +874,6 @@ void SkScalerContext::MakeRecAndEffects(const SkPaint& paint, #endif } - if (paint.isDevKernText()) { - flags |= SkScalerContext::kDevKernText_Flag; - } - if (style != SkPaint::kFill_Style && strokeWidth > 0) { rec->fFrameWidth = strokeWidth; rec->fMiterLimit = paint.getStrokeMiter(); diff --git a/src/core/SkScalerContext.h b/src/core/SkScalerContext.h index 84abdcc1a4..a15e276bcc 100644 --- a/src/core/SkScalerContext.h +++ b/src/core/SkScalerContext.h @@ -224,7 +224,7 @@ class SkScalerContext { public: enum Flags { kFrameAndFill_Flag = 0x0001, - kDevKernText_Flag = 0x0002, + kUnused = 0x0002, kEmbeddedBitmapText_Flag = 0x0004, kEmbolden_Flag = 0x0008, kSubpixelPositioning_Flag = 0x0010, diff --git a/src/core/SkTextBlob.cpp b/src/core/SkTextBlob.cpp index 2c29d9d613..e2d3be4518 100644 --- a/src/core/SkTextBlob.cpp +++ b/src/core/SkTextBlob.cpp @@ -67,7 +67,6 @@ private: SkPaint::kFakeBoldText_Flag | SkPaint::kLinearText_Flag | SkPaint::kSubpixelText_Flag | - SkPaint::kDevKernText_Flag | SkPaint::kLCDRenderText_Flag | SkPaint::kEmbeddedBitmapText_Flag | SkPaint::kAutoHinting_Flag | diff --git a/src/core/SkTextToPathIter.h b/src/core/SkTextToPathIter.h index 49564d96af..c135de620b 100644 --- a/src/core/SkTextToPathIter.h +++ b/src/core/SkTextToPathIter.h @@ -8,7 +8,6 @@ #ifndef SkTextToPathIter_DEFINED #define SkTextToPathIter_DEFINED -#include "SkAutoKern.h" #include "SkPaint.h" #include "SkStrikeCache.h" @@ -27,7 +26,6 @@ protected: SkPaint::GlyphCacheProc fGlyphCacheProc; SkScalar fXPos; // accumulated xpos, returned in next - SkAutoKern fAutoKern; int fXYIndex; // cache for horizontal -vs- vertical text }; diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp index 27c8dea670..e99d9df044 100644 --- a/src/gpu/text/GrAtlasTextContext.cpp +++ b/src/gpu/text/GrAtlasTextContext.cpp @@ -498,7 +498,6 @@ void GrAtlasTextContext::DrawBmpPosTextAsPaths(GrAtlasTextBlob* blob, int runInd pathPaint.setPathEffect(nullptr); SkPaint::GlyphCacheProc glyphCacheProc = SkPaint::GetGlyphCacheProc(pathPaint.getTextEncoding(), - pathPaint.isDevKernText(), true); auto cache = SkStrikeCache::FindOrCreateStrikeExclusive( pathPaint, &props, SkScalerContextFlags::kFakeGammaAndBoostContrast, nullptr); @@ -679,7 +678,7 @@ void GrAtlasTextContext::drawDFText(GrAtlasTextBlob* blob, int runIndex, const SkPaint& skPaint = paint.skPaint(); SkPaint::GlyphCacheProc glyphCacheProc = - SkPaint::GetGlyphCacheProc(skPaint.getTextEncoding(), skPaint.isDevKernText(), true); + SkPaint::GetGlyphCacheProc(skPaint.getTextEncoding(), true); SkTArray positions; @@ -705,14 +704,13 @@ void GrAtlasTextContext::drawDFText(GrAtlasTextBlob* blob, int runIndex, auto origPaintCache = SkStrikeCache::FindOrCreateStrikeExclusive(*desc.getDesc(), effects, *typeface); - SkAutoKern autokern; const char* stop = text + byteLength; while (textPtr < stop) { // don't need x, y here, since all subpixel variants will have the // same advance const SkGlyph& glyph = glyphCacheProc(origPaintCache.get(), &textPtr); - SkScalar width = SkFloatToScalar(glyph.fAdvanceX) + autokern.adjust(glyph); + SkScalar width = SkFloatToScalar(glyph.fAdvanceX); positions.push_back(stopX + origin * width); SkScalar height = SkFloatToScalar(glyph.fAdvanceY); @@ -777,7 +775,7 @@ void GrAtlasTextContext::drawDFPosText(GrAtlasTextBlob* blob, int runIndex, auto cache = blob->setupCache(runIndex, props, SkScalerContextFlags::kNone, dfPaint, nullptr); SkPaint::GlyphCacheProc glyphCacheProc = - SkPaint::GetGlyphCacheProc(dfPaint.getTextEncoding(), dfPaint.isDevKernText(), true); + SkPaint::GetGlyphCacheProc(dfPaint.getTextEncoding(), true); const char* stop = text + byteLength; @@ -884,8 +882,7 @@ void GrAtlasTextContext::FallbackTextHelper::drawText(GrAtlasTextBlob* blob, int SkExclusiveStrikePtr cache; const SkPaint& skPaint = paint.skPaint(); SkPaint::GlyphCacheProc glyphCacheProc = - SkPaint::GetGlyphCacheProc(skPaint.getTextEncoding(), - skPaint.isDevKernText(), true); + SkPaint::GetGlyphCacheProc(skPaint.getTextEncoding(), true); SkColor textColor = paint.filteredPremulColor(); SkScalar textRatio = SK_Scalar1; if (fUseScaledFallback) { diff --git a/src/gpu/text/GrTextUtils.cpp b/src/gpu/text/GrTextUtils.cpp index 738cfb68be..ab332e0417 100644 --- a/src/gpu/text/GrTextUtils.cpp +++ b/src/gpu/text/GrTextUtils.cpp @@ -62,7 +62,7 @@ bool GrTextUtils::PathTextIter::next(const SkGlyph** skGlyph, const SkPath** pat if (fText < fStop) { const SkGlyph& glyph = fGlyphCacheProc(fCache.get(), &fText); - fXPos += (fPrevAdvance + fAutoKern.adjust(glyph)) * fScale; + fXPos += fPrevAdvance * fScale; SkASSERT(0 == fXYIndex || 1 == fXYIndex); fPrevAdvance = SkFloatToScalar((&glyph.fAdvanceX)[fXYIndex]); diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp index 4c4c6d4f65..c5e8a65733 100644 --- a/src/ports/SkFontHost_FreeType.cpp +++ b/src/ports/SkFontHost_FreeType.cpp @@ -994,8 +994,6 @@ void SkScalerContext_FreeType::generateAdvance(SkGlyph* glyph) { fLoadGlyphFlags | FT_ADVANCE_FLAG_FAST_ONLY, &advance ); if (0 == error) { - glyph->fRsbDelta = 0; - glyph->fLsbDelta = 0; const SkScalar advanceScalar = SkFT_FixedToScalar(advance); glyph->fAdvanceX = SkScalarToFloat(fMatrix22Scalar.getScaleX() * advanceScalar); glyph->fAdvanceY = SkScalarToFloat(fMatrix22Scalar.getSkewY() * advanceScalar); @@ -1091,9 +1089,6 @@ bool SkScalerContext_FreeType::shouldSubpixelBitmap(const SkGlyph& glyph, const void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph) { SkAutoMutexAcquire ac(gFTMutex); - glyph->fRsbDelta = 0; - glyph->fLsbDelta = 0; - FT_Error err; if (this->setupSize()) { @@ -1184,11 +1179,6 @@ void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph) { } else { glyph->fAdvanceX = SkFDot6ToFloat(fFace->glyph->advance.x); glyph->fAdvanceY = -SkFDot6ToFloat(fFace->glyph->advance.y); - - if (fRec.fFlags & kDevKernText_Flag) { - glyph->fRsbDelta = SkToS8(fFace->glyph->rsb_delta); - glyph->fLsbDelta = SkToS8(fFace->glyph->lsb_delta); - } } } diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp index efd74f6f8e..8047c4352f 100644 --- a/src/ports/SkFontHost_mac.cpp +++ b/src/ports/SkFontHost_mac.cpp @@ -2249,8 +2249,7 @@ void SkTypeface_Mac::onFilterRec(SkScalerContextRec* rec) const { rec->setHinting(SkPaint::kNormal_Hinting); } - unsigned flagsWeDontSupport = SkScalerContext::kDevKernText_Flag | - SkScalerContext::kForceAutohinting_Flag | + unsigned flagsWeDontSupport = SkScalerContext::kForceAutohinting_Flag | SkScalerContext::kLCD_BGROrder_Flag | SkScalerContext::kLCD_Vertical_Flag; diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp index 7bc1e298aa..35a0a74b22 100644 --- a/src/ports/SkFontHost_win.cpp +++ b/src/ports/SkFontHost_win.cpp @@ -943,8 +943,6 @@ void SkScalerContext_GDI::generateMetrics(SkGlyph* glyph) { // TODO(benjaminwagner): What is the type of gm.gmCellInc[XY]? glyph->fAdvanceX = (float)((int)gm.gmCellIncX); glyph->fAdvanceY = (float)((int)gm.gmCellIncY); - glyph->fRsbDelta = 0; - glyph->fLsbDelta = 0; if (this->isSubpixel()) { sk_bzero(&gm, sizeof(gm)); @@ -2265,7 +2263,6 @@ void LogFontTypeface::onFilterRec(SkScalerContextRec* rec) const { } unsigned flagsWeDontSupport = SkScalerContext::kVertical_Flag | - SkScalerContext::kDevKernText_Flag | SkScalerContext::kForceAutohinting_Flag | SkScalerContext::kEmbeddedBitmapText_Flag | SkScalerContext::kEmbolden_Flag | diff --git a/src/ports/SkScalerContext_win_dw.cpp b/src/ports/SkScalerContext_win_dw.cpp index 8e73b16047..98d8ca812e 100644 --- a/src/ports/SkScalerContext_win_dw.cpp +++ b/src/ports/SkScalerContext_win_dw.cpp @@ -377,12 +377,6 @@ uint16_t SkScalerContext_DW::generateCharToGlyph(SkUnichar uni) { } void SkScalerContext_DW::generateAdvance(SkGlyph* glyph) { - //Delta is the difference between the right/left side bearing metric - //and where the right/left side bearing ends up after hinting. - //DirectWrite does not provide this information. - glyph->fRsbDelta = 0; - glyph->fLsbDelta = 0; - glyph->fAdvanceX = 0; glyph->fAdvanceY = 0; diff --git a/src/ports/SkTypeface_win_dw.cpp b/src/ports/SkTypeface_win_dw.cpp index 69be774612..69bf7ff034 100644 --- a/src/ports/SkTypeface_win_dw.cpp +++ b/src/ports/SkTypeface_win_dw.cpp @@ -258,7 +258,6 @@ void DWriteFontTypeface::onFilterRec(SkScalerContextRec* rec) const { } unsigned flagsWeDontSupport = SkScalerContext::kVertical_Flag | - SkScalerContext::kDevKernText_Flag | SkScalerContext::kForceAutohinting_Flag | SkScalerContext::kEmbolden_Flag | SkScalerContext::kLCD_Vertical_Flag; diff --git a/tests/TextBlobTest.cpp b/tests/TextBlobTest.cpp index 3e51baf534..6aabc45a2a 100644 --- a/tests/TextBlobTest.cpp +++ b/tests/TextBlobTest.cpp @@ -207,7 +207,6 @@ public: REPORTER_ASSERT(reporter, defaultPaint.isFakeBoldText() != font.isFakeBoldText()); REPORTER_ASSERT(reporter, defaultPaint.isLinearText() != font.isLinearText()); REPORTER_ASSERT(reporter, defaultPaint.isSubpixelText() != font.isSubpixelText()); - REPORTER_ASSERT(reporter, defaultPaint.isDevKernText() != font.isDevKernText()); REPORTER_ASSERT(reporter, defaultPaint.isLCDRenderText() != font.isLCDRenderText()); REPORTER_ASSERT(reporter, defaultPaint.isEmbeddedBitmapText() != font.isEmbeddedBitmapText()); REPORTER_ASSERT(reporter, defaultPaint.isAutohinted() != font.isAutohinted()); @@ -234,7 +233,6 @@ public: REPORTER_ASSERT(reporter, paint.isFakeBoldText() == font.isFakeBoldText()); REPORTER_ASSERT(reporter, paint.isLinearText() == font.isLinearText()); REPORTER_ASSERT(reporter, paint.isSubpixelText() == font.isSubpixelText()); - REPORTER_ASSERT(reporter, paint.isDevKernText() == font.isDevKernText()); REPORTER_ASSERT(reporter, paint.isLCDRenderText() == font.isLCDRenderText()); REPORTER_ASSERT(reporter, paint.isEmbeddedBitmapText() == font.isEmbeddedBitmapText()); REPORTER_ASSERT(reporter, paint.isAutohinted() == font.isAutohinted()); diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp index 9aab347fdb..ba54c88924 100644 --- a/tools/debugger/SkDrawCommand.cpp +++ b/tools/debugger/SkDrawCommand.cpp @@ -1268,7 +1268,6 @@ Json::Value SkDrawCommand::MakeJsonPaint(const SkPaint& paint, UrlDataManager& u store_bool(&result, SKDEBUGCANVAS_ATTRIBUTE_FAKEBOLDTEXT, paint.isFakeBoldText(), false); store_bool(&result, SKDEBUGCANVAS_ATTRIBUTE_LINEARTEXT, paint.isLinearText(), false); store_bool(&result, SKDEBUGCANVAS_ATTRIBUTE_SUBPIXELTEXT, paint.isSubpixelText(), false); - store_bool(&result, SKDEBUGCANVAS_ATTRIBUTE_DEVKERNTEXT, paint.isDevKernText(), false); store_bool(&result, SKDEBUGCANVAS_ATTRIBUTE_LCDRENDERTEXT, paint.isLCDRenderText(), false); store_bool(&result, SKDEBUGCANVAS_ATTRIBUTE_EMBEDDEDBITMAPTEXT, paint.isEmbeddedBitmapText(), false); store_bool(&result, SKDEBUGCANVAS_ATTRIBUTE_AUTOHINTING, paint.isAutohinted(), false); -- cgit v1.2.3