diff --git a/docs/SkCanvas_Reference.bmh b/docs/SkCanvas_Reference.bmh
index 2ad2b20cb4..dbce6a8b18 100644
--- a/docs/SkCanvas_Reference.bmh
+++ b/docs/SkCanvas_Reference.bmh
@@ -4078,7 +4078,7 @@ void draw(SkCanvas* canvas) {
Draws Text_Blob blob at (x, y), using Clip, Matrix, and Paint paint.
blob contains Glyphs, their positions, and paint attributes specific to text:
-#paint_font_metrics#.
+#font_metrics#.
Paint_Text_Encoding must be set to kGlyphID_SkTextEncoding.
@@ -4133,7 +4133,7 @@ void draw(SkCanvas* canvas) {
Draws Text_Blob blob at (x, y), using Clip, Matrix, and Paint paint.
blob contains Glyphs, their positions, and paint attributes specific to text:
-#paint_font_metrics#.
+#font_metrics#.
Paint_Text_Encoding must be set to kGlyphID_SkTextEncoding.
diff --git a/docs/SkFont_Reference.bmh b/docs/SkFont_Reference.bmh
index dc14d8111f..1d69f3488d 100644
--- a/docs/SkFont_Reference.bmh
+++ b/docs/SkFont_Reference.bmh
@@ -1,6 +1,17 @@
#Topic Font
#Alias Font_Reference ##
+#Code
+#Populate
+##
+
+#PhraseDef font_metrics
+Typeface, Font_Size, Font_Scale_X,
+Font_Skew_X, Font_Hinting, Paint_Anti_Alias, Font_Embolden, Font_Force_Hinting,
+Font_Embedded_Bitmaps, Font_Hinting_Spacing, Font_Anti_Alias, Font_Linear,
+and Font_Subpixel
+##
+
#Subtopic Advance
# incomplete, should probably be in overview, not reference
##
@@ -8,8 +19,111 @@
# incomplete, should probably be in overview, not reference
##
-#Code
-#Populate
+#Subtopic Size
+#Line # overall height in points ##
+Font_Size adjusts the overall text size in points.
+Font_Size can be set to any positive value or zero.
+Font_Size defaults to 12.
+Font_Size
+##
+
+#Subtopic Scale_X
+#Line # text horizontal scale ##
+Font_Scale_X adjusts the text horizontal scale.
+Text scaling approximates condensed and expanded type faces when the actual face
+is not available.
+Font_Scale_X can be set to any value.
+Font_Scale_X defaults to 1.
+##
+
+#Subtopic Skew_X
+#Line # text horizontal slant ##
+Font_Skew_X adjusts the text horizontal slant.
+Text skewing approximates italic and oblique type faces when the actual face
+is not available.
+Font_Skew_X can be set to any value.
+Font_Skew_X defaults to 0.
+##
+
+#Subtopic Embolden
+#Line # approximate font styles ##
+
+Font_Embolden approximates the bold font style accompanying a normal font when a bold font face
+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 Font_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 SkPaint::Style to
+SkPaint::kStrokeAndFill_Style as needed.
+
+Font_Embolden is disabled by default.
+#Subtopic Embolden ##
+
+#Subtopic Hinting_Spacing
+#Line # glyph spacing affected by hinting ##
+
+If Hinting is set to SkFontHinting::kFull, Hinting_Spacing adjusts the character
+spacing by the difference of the hinted and unhinted Left_Side_Bearing and
+Right_Side_Bearing. Hinting_Spacing only applies to platforms that use
+FreeType as their Font_Engine.
+
+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.
+#Subtopic Hinting_Spacing ##
+
+#Subtopic Linear
+#Line # selects text rendering as Glyph or Path ##
+Font_Linear selects whether text is rendered as a Glyph or as a Path.
+If Font_Linear is set, it has the same effect as setting Hinting to SkFontHinting::kNormal.
+If Font_Linear is clear, it is the same as setting Hinting to SkFontHinting::kNone.
+#Subtopic Linear ##
+
+#Subtopic Subpixel
+#Line # uses pixel transparency to represent fractional offset ##
+#Substitute sub-pixel
+Font_Subpixel 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.
+#Subtopic Subpixel ##
+
+#Subtopic Anti_Alias
+#Line # text relying on the order of RGB stripes ##
+When set, Anti_Alias positions glyphs within a pixel, using alpha and
+possibly RGB striping. It can take advantage of the organization of RGB stripes
+that create a color, and relies on the small size of the stripe and visual perception
+to make the color fringing imperceptible.
+
+Anti_Alias can be enabled on devices that orient stripes horizontally
+or vertically, and that order the color components as RGB or BGR. Internally, the
+glyph cache may store multiple copies of the same glyph with different sub-pixel
+positions, requiring more memory.
+#Subtopic Anti_Alias ##
+
+#Subtopic Force_Hinting
+#Line # always adjust glyph paths ##
+
+If Hinting is set to SkFontHinting::kNormal or SkFontHinting::kFull, Force_Hinting
+instructs the Font_Manager to always hint Glyphs.
+Force_Hinting has no effect if Hinting is set to SkFontHinting::kNone or
+SkFontHinting::kSlight.
+
+Force_Hinting only affects platforms that use FreeType as the Font_Manager.
+#Subtopic Force_Hinting ##
+
+#Subtopic Embedded_Bitmaps
+#Line # custom sized bitmap Glyphs ##
+Embedded_Bitmaps allows selecting custom sized bitmap Glyphs.
+Embedded_Bitmaps when set chooses an embedded bitmap glyph over an outline contained
+in a font if the platform supports this option.
+
+FreeType selects the bitmap glyph if available when Embedded_Bitmaps is set, and selects
+the outline glyph if Embedded_Bitmaps is clear.
+Windows may select the bitmap glyph but is not required to do so.
+OS_X and iOS do not support this option.
##
# ------------------------------------------------------------------------------
diff --git a/docs/SkPaint_Reference.bmh b/docs/SkPaint_Reference.bmh
index b6f179d3fb..a09d7c938f 100644
--- a/docs/SkPaint_Reference.bmh
+++ b/docs/SkPaint_Reference.bmh
@@ -1,13 +1,6 @@
#Topic Paint
#Alias Paint_Reference ##
-#PhraseDef paint_font_metrics
-Typeface, Paint_Text_Size, Paint_Text_Scale_X,
-Paint_Text_Skew_X, Paint_Hinting, Anti_Alias, Paint_Fake_Bold,
-Font_Embedded_Bitmaps, Full_Hinting_Spacing, LCD_Text, Linear_Text,
-and Subpixel_Text
-##
-
#Class SkPaint
#Code
@@ -55,29 +48,29 @@ Constructs Paint with default values.
# Color_Filter # nullptr ##
# Dither # false ##
# Draw_Looper # nullptr ##
-# Fake_Bold # false ##
# Filter_Quality # kNone_SkFilterQuality ##
+# Font_Force_Hinting # false ##
# Font_Embedded_Bitmaps # false ##
-# Automatic_Hinting # false ##
-# Full_Hinting_Spacing # false ##
-# Hinting # SkFontHinting::kNormal ##
+# Font_Embolden # false ##
+# Font_Hinting # SkFontHinting::kNormal ##
+# Font_Hinting_Spacing # false ##
+# Font_Anti_Alias # false ##
+# Font_Linear # false ##
+# Font_Scale_X # 1 ##
+# Font_Size # 12 ##
+# Font_Skew_X # 0 ##
+# Font_Subpixel # false ##
# Image_Filter # nullptr ##
-# LCD_Text # false ##
-# Linear_Text # false ##
# Miter_Limit # 4 ##
# Mask_Filter # nullptr ##
# Path_Effect # nullptr ##
# Shader # nullptr ##
# Style # kFill_Style ##
# Text_Encoding # kUTF8_SkTextEncoding ##
-# Text_Scale_X # 1 ##
-# Text_Size # 12 ##
-# Text_Skew_X # 0 ##
# Typeface # nullptr ##
# Stroke_Cap # kButt_Cap ##
# Stroke_Join # kMiter_Join ##
# Stroke_Width # 0 ##
-# Subpixel_Text # false ##
#Table ##
The flags, text size, hinting, and miter limit may be overridden at compile time by defining
@@ -353,22 +346,22 @@ multiple settings at once.
#Line # mask for setting Dither ##
##
#Const kFakeBoldText_Flag 0x0020
- #Line # mask for setting Fake_Bold ##
+ #Line # mask for setting Font_Embolden ##
##
#Const kLinearText_Flag 0x0040
- #Line # mask for setting Linear_Text ##
+ #Line # mask for setting Font_Linear ##
##
#Const kSubpixelText_Flag 0x0080
- #Line # mask for setting Subpixel_Text ##
+ #Line # mask for setting Font_Subpixel ##
##
#Const kLCDRenderText_Flag 0x0200
- #Line # mask for setting LCD_Text ##
+ #Line # mask for setting Font_Anti_Alias ##
##
#Const kEmbeddedBitmapText_Flag 0x0400
#Line # mask for setting Font_Embedded_Bitmaps ##
##
#Const kAutoHinting_Flag 0x0800
- #Line # mask for setting Automatic_Hinting ##
+ #Line # mask for setting Font_Force_Hinting ##
##
#Const kAllFlags 0xFFFF
#Line # mask of all Flags ##
@@ -645,12 +638,12 @@ void draw(SkCanvas* canvas) {
#Subtopic Device_Text
#Line # increase precision of glyph position ##
-LCD_Text and Subpixel_Text increase the precision of glyph position.
+Font_Anti_Alias and Font_Subpixel increase the precision of glyph position.
When set, Flags kLCDRenderText_Flag takes advantage of the organization of 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
+Font_Anti_Alias can be enabled on devices that orient stripes horizontally or vertically, and that order
the color components as RGB or BGR.
Flags kSubpixelText_Flag uses the pixel transparency to represent a fractional offset.
@@ -659,14 +652,14 @@ of the color increases, the edge of the glyph appears to move towards the outsid
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
+Font_Anti_Alias or Font_Subpixel can be enabled by default by setting SkPaintDefaults_Flags to
kLCDRenderText_Flag or kSubpixelText_Flag (or both) at compile time.
#Example
#Description
- Four commas are drawn normally and with combinations of LCD_Text and Subpixel_Text.
- When Subpixel_Text is disabled, the comma Glyphs are identical, but not evenly spaced.
- When Subpixel_Text is enabled, the comma Glyphs are unique, but appear evenly spaced.
+ Four commas are drawn normally and with combinations of Font_Anti_Alias and Font_Subpixel.
+ When Font_Subpixel is disabled, the comma Glyphs are identical, but not evenly spaced.
+ When Font_Subpixel is enabled, the comma Glyphs are unique, but appear evenly spaced.
##
SkBitmap bitmap;
@@ -691,12 +684,11 @@ kLCDRenderText_Flag or kSubpixelText_Flag (or both) at compile time.
#Subtopic Device_Text ##
#Subtopic Linear_Text
-#Alias Linear_Text ##
#Line # selects text rendering as Glyph or Path ##
-Linear_Text selects whether text is rendered as a Glyph or as a Path.
-If kLinearText_Flag is set, it has the same effect as setting Hinting to SkFontHinting::kNormal.
-If kLinearText_Flag is clear, it is the same as setting Hinting to SkFontHinting::kNone.
+Font_Linear selects whether text is rendered as a Glyph or as a Path.
+If Font_Linear is set, it has the same effect as setting Hinting to SkFontHinting::kNormal.
+If Font_Linear is clear, it is the same as setting Hinting to SkFontHinting::kNone.
#Subtopic Linear_Text ##
#Method bool isLinearText() const
@@ -755,7 +747,6 @@ If kLinearText_Flag is clear, it is the same as setting Hinting to SkFontHinting
##
#Subtopic Subpixel_Text
-#Alias Subpixel_Text ##
#Line # uses pixel transparency to represent fractional offset ##
Flags kSubpixelText_Flag uses the pixel transparency to represent a fractional offset.
@@ -765,7 +756,7 @@ of the color increases, the edge of the glyph appears to move towards the outsid
#Method bool isSubpixelText() const
#In Subpixel_Text
-#Line # returns true if Subpixel_Text is set ##
+#Line # returns true if Font_Subpixel is set ##
#Populate
#Example
@@ -786,7 +777,7 @@ SkDebugf("paint.isSubpixelText() %c= !!(paint.getFlags() & SkPaint::kSubpixelTex
#Method void setSubpixelText(bool subpixelText)
#In Subpixel_Text
-#Line # sets or clears Subpixel_Text ##
+#Line # sets or clears Font_Subpixel ##
#Populate
#Example
@@ -805,21 +796,16 @@ SkDebugf("paint.isSubpixelText() %c= !!(paint.getFlags() & SkPaint::kSubpixelTex
#Subtopic LCD_Text
#Line # text relying on the order of RGB stripes ##
-# make this a top level name, since it is under subtopic Device_Text
-#Alias LCD_Text
-#Substitute LCD text
-##
-
-When set, Flags kLCDRenderText_Flag takes advantage of the organization of RGB stripes that
+When set, Font_Anti_Alias takes advantage of the organization of 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
+Font_Anti_Alias can be enabled on devices that orient stripes horizontally or vertically, and that order
the color components as RGB or BGR.
#Subtopic LCD_Text ##
#Method bool isLCDRenderText() const
#In LCD_Text
-#Line # returns true if LCD_Text is set ##
+#Line # returns true if Font_Anti_Alias is set ##
#Populate
#Example
@@ -840,7 +826,7 @@ SkDebugf("paint.isLCDRenderText() %c= !!(paint.getFlags() & SkPaint::kLCDRenderT
#Method void setLCDRenderText(bool lcdText)
#In LCD_Text
-#Line # sets or clears LCD_Text ##
+#Line # sets or clears Font_Anti_Alias ##
#Populate
#Example
@@ -858,9 +844,8 @@ SkDebugf("paint.isLCDRenderText() %c= !!(paint.getFlags() & SkPaint::kLCDRenderT
##
# ------------------------------------------------------------------------------
-#Subtopic Font_Embedded_Bitmaps
+#Subtopic Embedded_Bitmaps
#Line # custom sized bitmap Glyphs ##
-#Alias Font_Embedded_Bitmaps ## # long-winded enough, alias so I don't type Paint_Font_...
Font_Embedded_Bitmaps allows selecting custom sized bitmap Glyphs.
Flags kEmbeddedBitmapText_Flag when set chooses an embedded bitmap glyph over an outline contained
@@ -903,10 +888,10 @@ kEmbeddedBitmapText_Flag at compile time.
canvas->scale(10, 10);
canvas->drawBitmap(bitmap, -2, 1);
##
-#Subtopic Font_Embedded_Bitmaps ##
+#Subtopic Embedded_Bitmaps ##
#Method bool isEmbeddedBitmapText() const
-#In Font_Embedded_Bitmaps
+#In Embedded_Bitmaps
#Line # returns true if Font_Embedded_Bitmaps is set ##
#Populate
@@ -931,7 +916,7 @@ kEmbeddedBitmapText_Flag at compile time.
##
#Method void setEmbeddedBitmapText(bool useEmbeddedBitmapText)
-#In Font_Embedded_Bitmaps
+#In Embedded_Bitmaps
#Line # sets or clears Font_Embedded_Bitmaps ##
#Populate
@@ -951,14 +936,13 @@ kEmbeddedBitmapText_Flag at compile time.
# ------------------------------------------------------------------------------
#Subtopic Automatic_Hinting
#Line # always adjust glyph paths ##
-#Substitute auto-hinting
-If Hinting is set to SkFontHinting::kNormal or SkFontHinting::kFull, Automatic_Hinting
+If Hinting is set to SkFontHinting::kNormal or SkFontHinting::kFull, Font_Force_Hinting
instructs the Font_Manager to always hint Glyphs.
-Automatic_Hinting has no effect if Hinting is set to SkFontHinting::kNone or
+Font_Force_Hinting has no effect if Hinting is set to SkFontHinting::kNone or
SkFontHinting::kSlight.
-Automatic_Hinting only affects platforms that use FreeType as the Font_Manager.
+Font_Force_Hinting only affects platforms that use FreeType as the Font_Manager.
#Subtopic Automatic_Hinting ##
#Method bool isAutohinted() const
@@ -1017,7 +1001,7 @@ Automatic_Hinting only affects platforms that use FreeType as the Font_Manager.
#Subtopic Fake_Bold
#Line # approximate font styles ##
-Fake_Bold approximates the bold font style accompanying a normal font when a bold font face
+Font_Embolden approximates the bold font style accompanying a normal font when a bold font face
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.
@@ -1028,7 +1012,7 @@ A FreeType based port may define SK_USE_FREETYPE_EMBOLDEN at compile time to dir
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.
-Fake_Bold is disabled by default.
+Font_Embolden is disabled by default.
#Example
#Height 128
@@ -1050,7 +1034,7 @@ void draw(SkCanvas* canvas) {
#Method bool isFakeBoldText() const
#In Fake_Bold
-#Line # returns true if Fake_Bold is set ##
+#Line # returns true if Font_Embolden is set ##
#Populate
#Example
@@ -1071,7 +1055,7 @@ void draw(SkCanvas* canvas) {
#Method void setFakeBoldText(bool fakeBoldText)
#In Fake_Bold
-#Line # sets or clears Fake_Bold ##
+#Line # sets or clears Font_Embolden ##
#Populate
#Example
@@ -1087,20 +1071,6 @@ void draw(SkCanvas* canvas) {
##
-# ------------------------------------------------------------------------------
-#Subtopic Full_Hinting_Spacing
-#Line # glyph spacing affected by hinting ##
-#Alias Full_Hinting_Spacing ## # long winded enough -- maybe things with two underscores auto-aliased?
-
-if Hinting is set to SkFontHinting::kFull, Full_Hinting_Spacing adjusts the character
-spacing by the difference of the hinted and unhinted Left_Side_Bearing and
-Right_Side_Bearing. Full_Hinting_Spacing only applies to platforms that use
-FreeType as their Font_Engine.
-
-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.
-#Subtopic Full_Hinting_Spacing ##
-
# ------------------------------------------------------------------------------
#Subtopic Filter_Quality_Methods
#Line # get and set Filter_Quality ##
@@ -3106,7 +3076,7 @@ void draw(SkCanvas* canvas) {
}
##
- #SeeAlso Text_Size Typeface Typeface_Methods
+ #SeeAlso Font_Size Typeface Typeface_Methods
##
diff --git a/docs/SkTextBlobBuilder_Reference.bmh b/docs/SkTextBlobBuilder_Reference.bmh
index 7874313f5c..cb5ceb5286 100644
--- a/docs/SkTextBlobBuilder_Reference.bmh
+++ b/docs/SkTextBlobBuilder_Reference.bmh
@@ -25,9 +25,9 @@ Helper class for constructing SkTextBlob.
RunBuffer supplies storage for Glyphs and positions within a run.
-A run is a sequence of Glyphs sharing Paint_Font_Metrics and positioning.
+A run is a sequence of Glyphs sharing Font_Metrics and positioning.
Each run may position its Glyphs in one of three ways:
-by specifying where the first Glyph is drawn, and allowing Paint_Font_Metrics to
+by specifying where the first Glyph is drawn, and allowing Font_Metrics to
determine the advance to subsequent Glyphs; by specifying a baseline, and
the position on that baseline for each Glyph in run; or by providing Point
array, one per Glyph.
diff --git a/docs/SkTextBlob_Reference.bmh b/docs/SkTextBlob_Reference.bmh
index 41a0a5b0e9..f8797f5350 100644
--- a/docs/SkTextBlob_Reference.bmh
+++ b/docs/SkTextBlob_Reference.bmh
@@ -104,7 +104,7 @@ for (int index = 0; index < 2; ++index) {
Creates Text_Blob with a single run. text meaning depends on Text_Encoding;
by default, text is encoded as UTF-8.
-font contains attributes used to define the run text: #paint_font_metrics#.
+font contains attributes used to define the run text: #font_metrics#.
#Param text character code points or Glyphs drawn ##
#Param byteLength byte length of text array ##
@@ -137,10 +137,10 @@ font contains attributes used to define the run text: #paint_font_metrics#.
#In Constructors
#Line # constructs Text_Blob with one run ##
-Creates Text_Blob with a single run. string meaning depends on Paint_Text_Encoding;
+Creates Text_Blob with a single run. string meaning depends on Text_Encoding;
by default, string is encoded as UTF-8.
-font contains Paint_Font_Metrics used to define the run text: #paint_font_metrics#.
+font contains Font_Metrics used to define the run text: #font_metrics#.
#Param string character code points or Glyphs drawn ##
#Param font text size, typeface, text scale, and so on, used to draw ##
diff --git a/docs/undocumented.bmh b/docs/undocumented.bmh
index 1a434c17db..c6e3fe6ab5 100644
--- a/docs/undocumented.bmh
+++ b/docs/undocumented.bmh
@@ -328,7 +328,7 @@ FT_Load_Glyph
##
#Topic ##
-#Topic Font_Types
+#Topic Text_Encoding
#Enum SkTextEncoding
#Const kUTF8_SkTextEncoding 0
##
@@ -358,8 +358,11 @@ encodes each character as one 32-bit word.
Font_Manager uses font data to convert character code points into glyph indices.
A glyph index is a 16-bit word.
-##
+#Enum SkTextEncoding ##
+#Topic Text_Encoding ##
+#Topic Font_Hinting
+#Line # glyph outline adjustment ##
#EnumClass SkFontHinting
#Const kNone 0
#Line # glyph outlines unchanged ##
@@ -392,8 +395,10 @@ A glyph index is a 16-bit word.
horizontally decimated LCD displays; FT_LOAD_TARGET_LCD_V is a
variant of FT_LOAD_TARGET_NORMAL optimized for vertically decimated LCD displays.
##
-##
+#EnumClass SkFontHinting ##
+#Topic Font_Hinting ##
+#Topic Font_Metrics
#Struct SkFontMetrics
#Line # values computed by Font_Manager using Typeface ##
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index 736541784d..817f3f1933 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -219,7 +219,7 @@ public:
kSubpixelText_Flag = 0x80, //!< mask for setting subpixel text
kLCDRenderText_Flag = 0x200, //!< mask for setting LCD text
kEmbeddedBitmapText_Flag = 0x400, //!< mask for setting font embedded bitmaps
- kAutoHinting_Flag = 0x800, //!< mask for setting auto-hinting
+ kAutoHinting_Flag = 0x800, //!< mask for setting force hinting
// 0x1000 used to be kVertical
kAllFlags = 0xFFFF, //!< mask of all Flags
};
@@ -379,7 +379,7 @@ public:
/** Sets whether to always hint glyphs.
If SkPaint::Hinting is set to SkFontHinting::kNormal or SkFontHinting::kFull
and useAutohinter is set, instructs the font manager to always hint glyphs.
- auto-hinting has no effect if SkPaint::Hinting is set to SkFontHinting::kNone or
+ useAutohinter has no effect if SkPaint::Hinting is set to SkFontHinting::kNone or
SkFontHinting::kSlight.
Only affects platforms that use FreeType as the font manager.
@@ -877,7 +877,7 @@ public:
/**
* Returns the text encoding. Text encoding describes how to interpret the text bytes pass
- * to methods like measureText() and drawText().
+ * to methods like measureText() and SkCanvas::drawText().
* @return the text encoding
*/
SkTextEncoding getTextEncoding() const {
@@ -886,7 +886,7 @@ public:
/**
* Sets the text encoding. Text encoding describes how to interpret the text bytes pass
- * to methods like measureText() and drawText().
+ * to methods like measureText() and SkCanvas::drawText().
* @param encoding the new text encoding
*/
void setTextEncoding(SkTextEncoding encoding);
diff --git a/site/user/api/SkCanvas_Reference.md b/site/user/api/SkCanvas_Reference.md
index efbd48fef3..24e6bf8e11 100644
--- a/site/user/api/SkCanvas_Reference.md
+++ b/site/user/api/SkCanvas_Reference.md
@@ -1645,7 +1645,7 @@ int saveLayerPreserveLCDTex
Saves SkMatrix and clip, and allocates a SkBitmap for subsequent drawing.
-LCD text is preserved when the layer is drawn to the prior layer.
+LCD text is preserved when the layer is drawn to the prior layer.
Calling restore() discards changes to SkMatrix and clip, and draws layer.
@@ -1661,8 +1661,8 @@ Optional SkPaint restoreToCount() with returned value to restore this and subsequent saves.
-Draw text on an opaque background so that LCD text blends correctly with the
-prior layer. LCD text drawn on a background with transparency may result in
+Draw text on an opaque background so that LCD text blends correctly with the
+prior layer. LCD text drawn on a background with transparency may result in
incorrect blending.
### Parameters
@@ -1763,7 +1763,7 @@ defining how Layer allocated by SkCanvas::kPreserveLCDText_SaveLayerFlag
2 |
-Creates Layer for LCD text. Flag is ignored if Layer Paint contains
+Creates Layer for LCD text. Flag is ignored if Layer Paint contains
Image_Filter or Color_Filter.
|
@@ -1864,7 +1864,7 @@ without introducing artifacts. fCli
fSaveLayerFlags |
fSaveLayerFlags are used to create Layer without transparency,
-create Layer for LCD text, and to create Layer with the
+create Layer for LCD text, and to create Layer with the
contents of the previous Layer.
|
@@ -5219,13 +5219,13 @@ void drawTextBlob(const Text_Blob blob at (x, y), using Clip, Matrix, and Paint paint.
-blob contains Glyphs, their positions, and paint attributes specific to text: Typeface, Paint_Text_Size, Paint_Text_Scale_X,
-Paint_Text_Skew_X, Paint_Hinting, Anti_Alias, Paint_Fake_Bold,
-Font_Embedded_Bitmaps, Full_Hinting_Spacing, LCD_Text, Linear_Text,
-and Subpixel_Text
+blob contains Glyphs, their positions, and paint attributes specific to text: Typeface, Font_Size, Font_Scale_X,
+Font_Skew_X, Font_Hinting, Paint_Anti_Alias, Font_Embolden, Font_Force_Hinting,
+Font_Embedded_Bitmaps, Font_Hinting_Spacing, Font_Anti_Alias, Font_Linear,
+and Font_Subpixel
.
-Paint_Text_Encoding must be set to SkPaint::kGlyphID_TextEncoding.
+Paint_Text_Encoding must be set to kGlyphID_SkTextEncoding.
Elements of paint: Anti_Alias, Blend_Mode, Color including Color_Alpha,
Color_Filter, Paint_Dither, Draw_Looper, Mask_Filter, Path_Effect, Shader, and
@@ -5251,7 +5251,7 @@ apply to Path created from drawTextBlob(const Text_Blob blob at (x, y), using Clip, Matrix, and Paint paint.
-blob contains Glyphs, their positions, and paint attributes specific to text: Typeface, Paint_Text_Size, Paint_Text_Scale_X,
-Paint_Text_Skew_X, Paint_Hinting, Anti_Alias, Paint_Fake_Bold,
-Font_Embedded_Bitmaps, Full_Hinting_Spacing, LCD_Text, Linear_Text,
-and Subpixel_Text
+blob contains Glyphs, their positions, and paint attributes specific to text: Typeface, Font_Size, Font_Scale_X,
+Font_Skew_X, Font_Hinting, Paint_Anti_Alias, Font_Embolden, Font_Force_Hinting,
+Font_Embedded_Bitmaps, Font_Hinting_Spacing, Font_Anti_Alias, Font_Linear,
+and Font_Subpixel
.
-Paint_Text_Encoding must be set to SkPaint::kGlyphID_TextEncoding.
+Paint_Text_Encoding must be set to kGlyphID_SkTextEncoding.
Elements of paint: Path_Effect, Mask_Filter, Shader, Color_Filter,
Image_Filter, and Draw_Looper; apply to blob.
diff --git a/site/user/api/SkFont_Reference.md b/site/user/api/SkFont_Reference.md
index de960f1961..260f0e93cd 100644
--- a/site/user/api/SkFont_Reference.md
+++ b/site/user/api/SkFont_Reference.md
@@ -2,16 +2,109 @@ SkFont Reference
===
-
-
-
-
class SkFont {
// SkFont interface
};
+
+
+
+
+
+
+Font_Size adjusts the overall text size in points.
+Font_Size can be set to any positive value or zero.
+Font_Size defaults to 12.
+Font_Size
+
+
+
+Font_Scale_X adjusts the text horizontal scale.
+Text scaling approximates condensed and expanded type faces when the actual face
+is not available.
+Font_Scale_X can be set to any value.
+Font_Scale_X defaults to 1.
+
+
+
+Font_Skew_X adjusts the text horizontal slant.
+Text skewing approximates italic and oblique type faces when the actual face
+is not available.
+Font_Skew_X can be set to any value.
+Font_Skew_X defaults to 0.
+
+
+
+Font_Embolden approximates the bold font style accompanying a normal font when a bold font face
+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 Font_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 SkPaint::Style to
+SkPaint::kStrokeAndFill_Style as needed.
+
+Font_Embolden is disabled by default.
+
+
+
+If Hinting is set to SkFontHinting::kFull, Hinting_Spacing adjusts the character
+spacing by the difference of the hinted and unhinted Left_Side_Bearing and
+Right_Side_Bearing. Hinting_Spacing only applies to platforms that use
+FreeType as their Font_Engine.
+
+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.
+
+
+
+Font_Linear selects whether text is rendered as a Glyph or as a Path.
+If Font_Linear is set, it has the same effect as setting Hinting to SkFontHinting::kNormal.
+If Font_Linear is clear, it is the same as setting Hinting to SkFontHinting::kNone.
+
+
+
+Font_Subpixel 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.
+
+
+
+When set, Anti_Alias positions glyphs within a pixel, using alpha and
+possibly RGB striping. It can take advantage of the organization of RGB stripes
+that create a color, and relies on the small size of the stripe and visual perception
+to make the color fringing imperceptible.
+
+Anti_Alias can be enabled on devices that orient stripes horizontally
+or vertically, and that order the color components as RGB or BGR. Internally, the
+glyph cache may store multiple copies of the same glyph with different sub-pixel
+positions, requiring more memory.
+
+
+
+If Hinting is set to SkFontHinting::kNormal or SkFontHinting::kFull, Force_Hinting
+instructs the Font_Manager to always hint Glyphs.
+Force_Hinting has no effect if Hinting is set to SkFontHinting::kNone or
+SkFontHinting::kSlight.
+
+Force_Hinting only affects platforms that use FreeType as the Font_Manager.
+
+
+
+Embedded_Bitmaps allows selecting custom sized bitmap Glyphs.
+Embedded_Bitmaps when set chooses an embedded bitmap glyph over an outline contained
+in a font if the platform supports this option.
+
+FreeType selects the bitmap glyph if available when Embedded_Bitmaps is set, and selects
+the outline glyph if Embedded_Bitmaps is clear.
+Windows may select the bitmap glyph but is not required to do so.
+OS_X and iOS do not support this option.
+
---
@@ -300,7 +393,7 @@ incomplete
bool isSubpixel()const
-Returns true if glyphs at different sub-pixel positions may differ on pixel edge coverage.
+Returns true if glyphs at different sub-pixel positions may differ on pixel edge coverage.
### Return Value
@@ -420,12 +513,12 @@ incomplete
void setSubpixel(bool subpixel)
-Requests, but does not require, that glyphs respect sub-pixel positioning.
+Requests, but does not require, that glyphs respect sub-pixel positioning.
### Parameters
@@ -991,7 +1084,7 @@ Returns true if byteLength is zero
number of bytes in text array |
encoding |
- text encoding |
+ text encoding |
@@ -1020,7 +1113,7 @@ Returns the bytes of text that fit within <
The text fragment fits if its advance width is less than or equal to maxWidth.
Measures only while the advance is less than or equal to maxWidth.
Returns the advance or the text fragment in measuredWidth if it not nullptr.
-Uses encoding to decode text, SkTypeface to get the font metrics,
+Uses encoding to decode text, SkTypeface to get the font metrics,
and text size to scale the metrics.
Does not scale the advance or bounds by fake bold.
@@ -1033,7 +1126,7 @@ Does not scale the advance or bounds by fake bold.
number of bytes of text to measure |
encoding |
- text encoding |
+ text encoding |
maxWidth |
advance limit; text is measured while advance is less than maxWidth |
diff --git a/site/user/api/SkPaint_Reference.md b/site/user/api/SkPaint_Reference.md
index fb370bf244..689554bb35 100644
--- a/site/user/api/SkPaint_Reference.md
+++ b/site/user/api/SkPaint_Reference.md
@@ -131,16 +131,8 @@ class SkPaint {
void setTextScaleX(SkScalar scaleX);
SkScalar getTextSkewX() const;
void setTextSkewX(SkScalar skewX);
-
- enum TextEncoding : uint8_t {
- kUTF8_TextEncoding,
- kUTF16_TextEncoding,
- kUTF32_TextEncoding,
- kGlyphID_TextEncoding,
- };
-
- TextEncoding getTextEncoding() const;
- void setTextEncoding(TextEncoding encoding);
+ SkTextEncoding getTextEncoding() const;
+ void setTextEncoding(SkTextEncoding encoding);
typedef SkFontMetrics FontMetrics;
@@ -219,29 +211,29 @@ Constructs Paint with default values.
| Color_Filter | nullptr |
| Dither | false |
| Draw_Looper | nullptr |
-| Fake_Bold | false |
| Filter_Quality | kNone_SkFilterQuality |
-| Font_Embedded_Bitmaps | false |
-| Automatic_Hinting | false |
-| Full_Hinting_Spacing | false |
-| Hinting | SkFontHinting::kNormal |
+| Font_Force_Hinting | false |
+| Font_Embedded_Bitmaps | false |
+| Font_Embolden | false |
+| Font_Hinting | SkFontHinting::kNormal |
+| Font_Hinting_Spacing | false |
+| Font_Anti_Alias | false |
+| Font_Linear | false |
+| Font_Scale_X | 1 |
+| Font_Size | 12 |
+| Font_Skew_X | 0 |
+| Font_Subpixel | false |
| Image_Filter | nullptr |
-| LCD_Text | false |
-| Linear_Text | false |
| Miter_Limit | 4 |
| Mask_Filter | nullptr |
| Path_Effect | nullptr |
| Shader | nullptr |
| Style | kFill_Style |
-| Text_Encoding | kUTF8_TextEncoding |
-| Text_Scale_X | 1 |
-| Text_Size | 12 |
-| Text_Skew_X | 0 |
+| Text_Encoding | kUTF8_SkTextEncoding |
| Typeface | nullptr |
| Stroke_Cap | kButt_Cap |
| Stroke_Join | kMiter_Join |
| Stroke_Width | 0 |
-| Subpixel_Text | false |
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
@@ -678,25 +670,25 @@ mask for setting Dither
SkPaint::kFakeBoldText_Flag |
0x0020 |
-mask for setting Fake_Bold |
+mask for setting Font_Embolden
SkPaint::kLinearText_Flag |
0x0040 |
-mask for setting Linear_Text |
+mask for setting Font_Linear
SkPaint::kSubpixelText_Flag |
0x0080 |
-mask for setting Subpixel_Text |
+mask for setting Font_Subpixel
SkPaint::kLCDRenderText_Flag |
0x0200 |
-mask for setting LCD_Text |
+mask for setting Font_Anti_Alias
SkPaint::kEmbeddedBitmapText_Flag |
@@ -708,7 +700,7 @@ mask for setting Font_Embedded_Bitmaps
SkPaint::kAutoHinting_Flag |
0x0800 |
-mask for setting Automatic_Hinting |
+mask for setting Font_Force_Hinting
SkPaint::kAllFlags |
@@ -979,12 +971,12 @@ paint1 == paint2
---
-LCD_Text and Subpixel_Text increase the precision of glyph position.
+Font_Anti_Alias and Font_Subpixel increase the precision of glyph position.
When set, Flags kLCDRenderText_Flag takes advantage of the organization of 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
+Font_Anti_Alias can be enabled on devices that orient stripes horizontally or vertically, and that order
the color components as RGB or BGR.
Flags kSubpixelText_Flag uses the pixel transparency to represent a fractional offset.
@@ -993,21 +985,21 @@ of the color increases, the edge of the kLCDRenderText_Flag and kSubpixelText_Flag are clear by default.
-LCD_Text or Subpixel_Text can be enabled by default by setting SkPaintDefaults_Flags to
+Font_Anti_Alias or Font_Subpixel can be enabled by default by setting SkPaintDefaults_Flags to
kLCDRenderText_Flag or kSubpixelText_Flag (or both) at compile time.
### Example
-Four commas are drawn normally and with combinations of
LCD_Text and
Subpixel_Text.
-When
Subpixel_Text is disabled, the comma
Glyphs are identical, but not evenly spaced.
-When
Subpixel_Text is enabled, the comma
Glyphs are unique, but appear evenly spaced.
+
-
Linear_Text selects whether
text is rendered as a
Glyph or as a
Path.
-If
kLinearText_Flag is set, it has the same effect as setting Hinting to
SkFontHinting::
kNormal.
-If
kLinearText_Flag is clear, it is the same as setting Hinting to
SkFontHinting::
kNone.
+
Font_Linear selects whether
text is rendered as a
Glyph or as a
Path.
+If
Font_Linear is set, it has the same effect as setting Hinting to
SkFontHinting::
kNormal.
+If
Font_Linear is clear, it is the same as setting Hinting to
SkFontHinting::
kNone.
@@ -1077,7 +1069,7 @@ of the
color increases, the edge of the
isSubpixelText()const
-Returns true if
glyphs at different sub-pixel positions may differ on
pixel edge coverage.
+Returns true if
glyphs at different
sub-pixel positions may differ on
pixel edge coverage.
Equivalent to
getFlags() masked with
kSubpixelText_Flag.
@@ -1106,7 +1098,7 @@ paint.isSubpixelText() == !!(paint.getFlags() & SkPaint::kSubpixelText_Flag)
void
setSubpixelText(bool subpixelText)
-Requests, but does not require, that
glyphs respect sub-pixel positioning.
+Requests, but does not require, that
glyphs respect
sub-pixel positioning.
Sets
kSubpixelText_Flag if
subpixelText is true.
Clears
kSubpixelText_Flag if
subpixelText is false.
@@ -1132,10 +1124,10 @@ paint1 == paint2
-When set,
Flags kLCDRenderText_Flag takes advantage of the organization of RGB stripes that
+When set,
Font_Anti_Alias takes advantage of the organization of 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
+
Font_Anti_Alias can be enabled on devices that orient stripes horizontally or vertically, and that order
the
color components as RGB or BGR.
@@ -1199,11 +1191,11 @@ paint1 == paint2
-
+
---
-Font_Embedded_Bitmaps allows selecting custom sized bitmap Glyphs.
+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.
@@ -1212,8 +1204,8 @@ the outline glyph if bitmap glyph but is not required to do so.
OS_X and iOS do not support this option.
-Font_Embedded_Bitmaps is disabled by default.
-Font_Embedded_Bitmaps can be enabled by default by setting SkPaintDefaults_Flags to
+Font_Embedded_Bitmaps is disabled by default.
+Font_Embedded_Bitmaps can be enabled by default by setting SkPaintDefaults_Flags to
kEmbeddedBitmapText_Flag at compile time.
### Example
@@ -1304,12 +1296,12 @@ paint1 == paint2
-If Hinting is set to SkFontHinting::kNormal or SkFontHinting::kFull, Automatic_Hinting
+If Hinting is set to SkFontHinting::kNormal or SkFontHinting::kFull, Font_Force_Hinting
instructs the Font_Manager to always hint Glyphs.
-Automatic_Hinting has no effect if Hinting is set to SkFontHinting::kNone or
+Font_Force_Hinting has no effect if Hinting is set to SkFontHinting::kNone or
SkFontHinting::kSlight.
-Automatic_Hinting only affects platforms that use FreeType as the Font_Manager.
+Font_Force_Hinting only affects platforms that use FreeType as the Font_Manager.
@@ -1357,7 +1349,7 @@ void setAutohinted(bool useAutohinter)
Sets whether to always hint glyphs.
If SkPaint::Hinting is set to SkFontHinting::kNormal or SkFontHinting::kFull
and useAutohinter is set, instructs the font manager to always hint glyphs.
-auto-hinting has no effect if SkPaint::Hinting is set to SkFontHinting::kNone or
+useAutohinter has no effect if SkPaint::Hinting is set to SkFontHinting::kNone or
SkFontHinting::kSlight.
Only affects platforms that use FreeType as the font manager.
@@ -1384,7 +1376,7 @@ Clears kAutoHinting_Flag if Fake_Bold approximates the bold font style accompanying a normal font when a bold font face
+Font_Embolden approximates the bold font style accompanying a normal font when a bold font face
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.
@@ -1395,7 +1387,7 @@ A FreeType based port may define SK_USE_FREETYPE_EMBOLDEN at compile time to dir
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.
-Fake_Bold is disabled by default.
+Font_Embolden is disabled by default.
### Example
@@ -1463,16 +1455,6 @@ paint1 == paint2
-
-
-if Hinting is set to SkFontHinting::kFull, Full_Hinting_Spacing adjusts the character
-spacing by the difference of the hinted and unhinted Left_Side_Bearing and
-Right_Side_Bearing. Full_Hinting_Spacing only applies to platforms that use
-FreeType as their Font_Engine.
-
-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.
-
---
@@ -3577,74 +3559,9 @@ Default value is zero.
---
-
-
----
-
-
- enum TextEncoding : uint8_t {
- kUTF8_TextEncoding,
- kUTF16_TextEncoding,
- kUTF32_TextEncoding,
- kGlyphID_TextEncoding,
- };
-
-
-
-TextEncoding determines whether text specifies character codes and their encoded
-size, or glyph indices. Characters are encoded as specified by the
-Unicode standard .
-
-Character codes encoded size are specified by UTF-8, UTF-16, or UTF-32.
-All character code formats are able to represent all of Unicode, differing only
-in the total storage required.
-
-UTF-8 (RFC 3629) encodes each character as one or more 8-bit bytes.
-
-UTF-16 (RFC 2781) encodes each character as one or two 16-bit words.
-
-UTF-32 encodes each character as one 32-bit word.
-
-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.
-
-### Constants
-
-
-
### Example
-First
line is encoded in UTF-8.
+