fix bookmaker
Move some documentation from SkPaint_Reference.bmh to SkFont_Reference.bmh. Since the legacy routines are still in SkPaint.h (and not yet marked as deprecated) duplicate much of it for now. This get bookmaker running without error, but the generated documentation is not organized. TBR=reed@google.com,bungeman@google.com Docs-Preview: https://skia.org/?cl=175241 Bug: skia: Change-Id: I31e7dff425e8c0bbac0179a1f3546fbc38fc4504 Reviewed-on: https://skia-review.googlesource.com/c/175241 Commit-Queue: Cary Clark <caryclark@skia.org> Reviewed-by: Cary Clark <caryclark@skia.org>
This commit is contained in:
parent
b45d512481
commit
3e73dcf24b
@ -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.
|
||||
|
||||
|
@ -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.
|
||||
##
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -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
|
||||
|
||||
##
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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 ##
|
||||
|
@ -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 ##
|
||||
|
||||
|
@ -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);
|
||||
|
@ -1645,7 +1645,7 @@ int <a href='#SkCanvas_saveLayerPreserveLCDTextRequests'>saveLayerPreserveLCDTex
|
||||
</pre>
|
||||
|
||||
Saves <a href='SkMatrix_Reference#SkMatrix'>SkMatrix</a> and clip, and allocates a <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> for subsequent drawing.
|
||||
<a href='SkPaint_Reference#LCD_Text'>LCD text</a> is preserved when the <a href='SkCanvas_Reference#Layer'>layer</a> is drawn to the prior <a href='SkCanvas_Reference#Layer'>layer</a>.
|
||||
LCD <a href='undocumented#Text'>text</a> is preserved when the <a href='SkCanvas_Reference#Layer'>layer</a> is drawn to the prior <a href='SkCanvas_Reference#Layer'>layer</a>.
|
||||
|
||||
Calling <a href='#SkCanvas_restore'>restore()</a> discards changes to <a href='SkMatrix_Reference#SkMatrix'>SkMatrix</a> and clip, and draws <a href='SkCanvas_Reference#Layer'>layer</a>.
|
||||
|
||||
@ -1661,8 +1661,8 @@ Optional <a href='SkPaint_Reference#SkPaint'>SkPaint</a> <a href='#SkCanvas_save
|
||||
|
||||
Call <a href='#SkCanvas_restoreToCount'>restoreToCount</a>() with returned value to restore this and subsequent saves.
|
||||
|
||||
Draw <a href='undocumented#Text'>text</a> on an opaque background so that <a href='SkPaint_Reference#LCD_Text'>LCD text</a> blends correctly with the
|
||||
prior <a href='SkCanvas_Reference#Layer'>layer</a>. <a href='SkPaint_Reference#LCD_Text'>LCD text</a> drawn on a background with transparency may result in
|
||||
Draw <a href='undocumented#Text'>text</a> on an opaque background so that LCD <a href='undocumented#Text'>text</a> blends correctly with the
|
||||
prior <a href='SkCanvas_Reference#Layer'>layer</a>. LCD <a href='undocumented#Text'>text</a> drawn on a background with transparency may result in
|
||||
incorrect blending.
|
||||
|
||||
### Parameters
|
||||
@ -1763,7 +1763,7 @@ defining how <a href='SkCanvas_Reference#Layer'>Layer</a> allocated by <a href='
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkCanvas_kPreserveLCDText_SaveLayerFlag'><code>SkCanvas::kPreserveLCDText_SaveLayerFlag</code></a></td>
|
||||
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>2</td>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
|
||||
Creates <a href='SkCanvas_Reference#Layer'>Layer</a> for <a href='SkPaint_Reference#LCD_Text'>LCD text</a>. Flag is ignored if <a href='SkCanvas_Reference#Layer'>Layer</a> <a href='SkPaint_Reference#Paint'>Paint</a> contains
|
||||
Creates <a href='SkCanvas_Reference#Layer'>Layer</a> for LCD <a href='undocumented#Text'>text</a>. Flag is ignored if <a href='SkCanvas_Reference#Layer'>Layer</a> <a href='SkPaint_Reference#Paint'>Paint</a> contains
|
||||
<a href='#Image_Filter'>Image_Filter</a> or <a href='#Color_Filter'>Color_Filter</a>.
|
||||
</td>
|
||||
</tr>
|
||||
@ -1864,7 +1864,7 @@ without introducing artifacts. <a href='#SkCanvas_SaveLayerRec_fClipMatrix'>fCli
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkCanvas_SaveLayerRec_fSaveLayerFlags'><code>fSaveLayerFlags</code></a></td>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
|
||||
<a href='#SkCanvas_SaveLayerRec_fSaveLayerFlags'>fSaveLayerFlags</a> are used to create <a href='SkCanvas_Reference#Layer'>Layer</a> without transparency,
|
||||
create <a href='SkCanvas_Reference#Layer'>Layer</a> for <a href='SkPaint_Reference#LCD_Text'>LCD text</a>, and to create <a href='SkCanvas_Reference#Layer'>Layer</a> with the
|
||||
create <a href='SkCanvas_Reference#Layer'>Layer</a> for LCD <a href='undocumented#Text'>text</a>, and to create <a href='SkCanvas_Reference#Layer'>Layer</a> with the
|
||||
contents of the previous <a href='SkCanvas_Reference#Layer'>Layer</a>.
|
||||
</td>
|
||||
</tr>
|
||||
@ -5219,13 +5219,13 @@ void <a href='#SkCanvas_drawTextBlob'>drawTextBlob</a>(const <a href='SkTextBlob
|
||||
|
||||
Draws <a href='#Text_Blob'>Text_Blob</a> <a href='#SkCanvas_drawTextBlob_blob'>blob</a> at (<a href='#SkCanvas_drawTextBlob_x'>x</a>, <a href='#SkCanvas_drawTextBlob_y'>y</a>), using Clip, <a href='SkMatrix_Reference#Matrix'>Matrix</a>, and <a href='SkPaint_Reference#Paint'>Paint</a> <a href='#SkCanvas_drawTextBlob_paint'>paint</a>.
|
||||
|
||||
<a href='#SkCanvas_drawTextBlob_blob'>blob</a> contains <a href='undocumented#Glyph'>Glyphs</a>, their positions, and <a href='#SkCanvas_drawTextBlob_paint'>paint</a> attributes specific to <a href='undocumented#Text'>text</a>: <a href='undocumented#Typeface'>Typeface</a>, <a href='#Paint_Text_Size'>Paint_Text_Size</a>, <a href='#Paint_Text_Scale_X'>Paint_Text_Scale_X</a>,
|
||||
<a href='#Paint_Text_Skew_X'>Paint_Text_Skew_X</a>, <a href='#Paint_Hinting'>Paint_Hinting</a>, <a href='#Paint_Anti_Alias'>Anti_Alias</a>, <a href='#Paint_Fake_Bold'>Paint_Fake_Bold</a>,
|
||||
<a href='#Paint_Font_Embedded_Bitmaps'>Font_Embedded_Bitmaps</a>, <a href='#Paint_Full_Hinting_Spacing'>Full_Hinting_Spacing</a>, <a href='#Paint_LCD_Text'>LCD_Text</a>, <a href='#Paint_Linear_Text'>Linear_Text</a>,
|
||||
and <a href='#Paint_Subpixel_Text'>Subpixel_Text</a>
|
||||
<a href='#SkCanvas_drawTextBlob_blob'>blob</a> contains <a href='undocumented#Glyph'>Glyphs</a>, their positions, and <a href='#SkCanvas_drawTextBlob_paint'>paint</a> attributes specific to <a href='undocumented#Text'>text</a>: <a href='undocumented#Typeface'>Typeface</a>, <a href='#Font_Size'>Font_Size</a>, <a href='#Font_Scale_X'>Font_Scale_X</a>,
|
||||
<a href='#Font_Skew_X'>Font_Skew_X</a>, <a href='#Font_Hinting'>Font_Hinting</a>, <a href='#Paint_Anti_Alias'>Paint_Anti_Alias</a>, <a href='#Font_Embolden'>Font_Embolden</a>, <a href='#Font_Force_Hinting'>Font_Force_Hinting</a>,
|
||||
<a href='#Font_Embedded_Bitmaps'>Font_Embedded_Bitmaps</a>, <a href='#Font_Hinting_Spacing'>Font_Hinting_Spacing</a>, <a href='#Font_Anti_Alias'>Font_Anti_Alias</a>, <a href='#Font_Linear'>Font_Linear</a>,
|
||||
and <a href='#Font_Subpixel'>Font_Subpixel</a>
|
||||
.
|
||||
|
||||
<a href='#Paint_Text_Encoding'>Paint_Text_Encoding</a> must be set to <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_kGlyphID_TextEncoding'>kGlyphID_TextEncoding</a>.
|
||||
<a href='#Paint_Text_Encoding'>Paint_Text_Encoding</a> must be set to <a href='undocumented#kGlyphID_SkTextEncoding'>kGlyphID_SkTextEncoding</a>.
|
||||
|
||||
Elements of <a href='#SkCanvas_drawTextBlob_paint'>paint</a>: <a href='#Paint_Anti_Alias'>Anti_Alias</a>, <a href='#Blend_Mode'>Blend_Mode</a>, <a href='SkColor_Reference#Color'>Color</a> including <a href='#Color_Alpha'>Color_Alpha</a>,
|
||||
<a href='#Color_Filter'>Color_Filter</a>, <a href='#Paint_Dither'>Paint_Dither</a>, <a href='#Draw_Looper'>Draw_Looper</a>, <a href='#Mask_Filter'>Mask_Filter</a>, <a href='#Path_Effect'>Path_Effect</a>, <a href='undocumented#Shader'>Shader</a>, and
|
||||
@ -5251,7 +5251,7 @@ apply to <a href='SkPath_Reference#Path'>Path</a> created from <a href='#SkCanva
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="a207bbd7317bfbdadbda8af884631e46"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="005502b502c1282cb8d306d6c8d998fb"></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -5267,13 +5267,13 @@ void <a href='#SkCanvas_drawTextBlob'>drawTextBlob</a>(const <a href='undocument
|
||||
|
||||
Draws <a href='#Text_Blob'>Text_Blob</a> <a href='#SkCanvas_drawTextBlob_2_blob'>blob</a> at (<a href='#SkCanvas_drawTextBlob_2_x'>x</a>, <a href='#SkCanvas_drawTextBlob_2_y'>y</a>), using Clip, <a href='SkMatrix_Reference#Matrix'>Matrix</a>, and <a href='SkPaint_Reference#Paint'>Paint</a> <a href='#SkCanvas_drawTextBlob_2_paint'>paint</a>.
|
||||
|
||||
<a href='#SkCanvas_drawTextBlob_2_blob'>blob</a> contains <a href='undocumented#Glyph'>Glyphs</a>, their positions, and <a href='#SkCanvas_drawTextBlob_2_paint'>paint</a> attributes specific to <a href='undocumented#Text'>text</a>: <a href='undocumented#Typeface'>Typeface</a>, <a href='#Paint_Text_Size'>Paint_Text_Size</a>, <a href='#Paint_Text_Scale_X'>Paint_Text_Scale_X</a>,
|
||||
<a href='#Paint_Text_Skew_X'>Paint_Text_Skew_X</a>, <a href='#Paint_Hinting'>Paint_Hinting</a>, <a href='#Paint_Anti_Alias'>Anti_Alias</a>, <a href='#Paint_Fake_Bold'>Paint_Fake_Bold</a>,
|
||||
<a href='#Paint_Font_Embedded_Bitmaps'>Font_Embedded_Bitmaps</a>, <a href='#Paint_Full_Hinting_Spacing'>Full_Hinting_Spacing</a>, <a href='#Paint_LCD_Text'>LCD_Text</a>, <a href='#Paint_Linear_Text'>Linear_Text</a>,
|
||||
and <a href='#Paint_Subpixel_Text'>Subpixel_Text</a>
|
||||
<a href='#SkCanvas_drawTextBlob_2_blob'>blob</a> contains <a href='undocumented#Glyph'>Glyphs</a>, their positions, and <a href='#SkCanvas_drawTextBlob_2_paint'>paint</a> attributes specific to <a href='undocumented#Text'>text</a>: <a href='undocumented#Typeface'>Typeface</a>, <a href='#Font_Size'>Font_Size</a>, <a href='#Font_Scale_X'>Font_Scale_X</a>,
|
||||
<a href='#Font_Skew_X'>Font_Skew_X</a>, <a href='#Font_Hinting'>Font_Hinting</a>, <a href='#Paint_Anti_Alias'>Paint_Anti_Alias</a>, <a href='#Font_Embolden'>Font_Embolden</a>, <a href='#Font_Force_Hinting'>Font_Force_Hinting</a>,
|
||||
<a href='#Font_Embedded_Bitmaps'>Font_Embedded_Bitmaps</a>, <a href='#Font_Hinting_Spacing'>Font_Hinting_Spacing</a>, <a href='#Font_Anti_Alias'>Font_Anti_Alias</a>, <a href='#Font_Linear'>Font_Linear</a>,
|
||||
and <a href='#Font_Subpixel'>Font_Subpixel</a>
|
||||
.
|
||||
|
||||
<a href='#Paint_Text_Encoding'>Paint_Text_Encoding</a> must be set to <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_kGlyphID_TextEncoding'>kGlyphID_TextEncoding</a>.
|
||||
<a href='#Paint_Text_Encoding'>Paint_Text_Encoding</a> must be set to <a href='undocumented#kGlyphID_SkTextEncoding'>kGlyphID_SkTextEncoding</a>.
|
||||
|
||||
Elements of <a href='#SkCanvas_drawTextBlob_2_paint'>paint</a>: <a href='#Path_Effect'>Path_Effect</a>, <a href='#Mask_Filter'>Mask_Filter</a>, <a href='undocumented#Shader'>Shader</a>, <a href='#Color_Filter'>Color_Filter</a>,
|
||||
<a href='#Image_Filter'>Image_Filter</a>, and <a href='#Draw_Looper'>Draw_Looper</a>; apply to <a href='#SkCanvas_drawTextBlob_2_blob'>blob</a>.
|
||||
|
@ -2,16 +2,109 @@ SkFont Reference
|
||||
===
|
||||
|
||||
|
||||
<a name='Advance'></a>
|
||||
|
||||
<a name='Engine'></a>
|
||||
|
||||
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
|
||||
class <a href='SkFont_Reference#SkFont'>SkFont</a> {
|
||||
// <i><a href='SkFont_Reference#SkFont'>SkFont</a> interface</i>
|
||||
};
|
||||
</pre>
|
||||
|
||||
<a name='Advance'></a>
|
||||
|
||||
<a name='Engine'></a>
|
||||
|
||||
<a name='Size'></a>
|
||||
|
||||
<a href='#Font_Size'>Font_Size</a> adjusts the overall <a href='undocumented#Text'>text</a> <a href='undocumented#Size'>size</a> in <a href='SkPoint_Reference#Point'>points</a>.
|
||||
<a href='#Font_Size'>Font_Size</a> can be set to any positive value or zero.
|
||||
<a href='#Font_Size'>Font_Size</a> defaults to 12.
|
||||
<a href='#Font_Size'>Font_Size</a>
|
||||
|
||||
<a name='Scale_X'></a>
|
||||
|
||||
<a href='#Font_Scale_X'>Font_Scale_X</a> adjusts the <a href='undocumented#Text'>text</a> horizontal scale.
|
||||
<a href='undocumented#Text'>Text</a> scaling approximates condensed and expanded type faces when the actual face
|
||||
is not available.
|
||||
<a href='#Font_Scale_X'>Font_Scale_X</a> can be set to any value.
|
||||
<a href='#Font_Scale_X'>Font_Scale_X</a> defaults to 1.
|
||||
|
||||
<a name='Skew_X'></a>
|
||||
|
||||
<a href='#Font_Skew_X'>Font_Skew_X</a> adjusts the <a href='undocumented#Text'>text</a> horizontal slant.
|
||||
<a href='undocumented#Text'>Text</a> skewing approximates italic and oblique type faces when the actual face
|
||||
is not available.
|
||||
<a href='#Font_Skew_X'>Font_Skew_X</a> can be set to any value.
|
||||
<a href='#Font_Skew_X'>Font_Skew_X</a> defaults to 0.
|
||||
|
||||
<a name='Embolden'></a>
|
||||
|
||||
<a href='#Font_Embolden'>Font_Embolden</a> approximates the bold <a href='SkFont_Reference#Font'>font</a> style accompanying a normal <a href='SkFont_Reference#Font'>font</a> when a bold <a href='SkFont_Reference#Font'>font</a> face
|
||||
is not available. Skia does not provide <a href='SkFont_Reference#Font'>font</a> substitution; it is up to the client to find the
|
||||
bold <a href='SkFont_Reference#Font'>font</a> face using the platform <a href='#Font_Manager'>Font_Manager</a>.
|
||||
|
||||
Use <a href='#Font_Skew_X'>Font_Skew_X</a> to approximate an italic <a href='SkFont_Reference#Font'>font</a> style when the italic <a href='SkFont_Reference#Font'>font</a> face
|
||||
is not available.
|
||||
|
||||
A FreeType based port may define SK_USE_FREETYPE_EMBOLDEN at compile time to direct
|
||||
the <a href='SkFont_Reference#Font_Engine'>font engine</a> to create the bold <a href='undocumented#Glyph'>Glyphs</a>. Otherwise, the extra bold is computed
|
||||
by increasing the stroke width and setting the <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_Style'>Style</a> to
|
||||
<a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_kStrokeAndFill_Style'>kStrokeAndFill_Style</a> as needed.
|
||||
|
||||
<a href='#Font_Embolden'>Font_Embolden</a> is disabled by default.
|
||||
|
||||
<a name='Hinting_Spacing'></a>
|
||||
|
||||
If Hinting is set to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kFull'>kFull</a>, <a href='#Font_Hinting_Spacing'>Hinting_Spacing</a> adjusts the character
|
||||
spacing by the difference of the hinted and unhinted <a href='#Left_Side_Bearing'>Left_Side_Bearing</a> and
|
||||
<a href='#Right_Side_Bearing'>Right_Side_Bearing</a>. <a href='#Font_Hinting_Spacing'>Hinting_Spacing</a> only applies to platforms that use
|
||||
FreeType as their <a href='#Font_Engine'>Font_Engine</a>.
|
||||
|
||||
<a href='#Font_Hinting_Spacing'>Hinting_Spacing</a> is not related to <a href='undocumented#Text'>text</a> kerning, where the space between
|
||||
a specific pair of characters is adjusted using <a href='undocumented#Data'>data</a> in the <a href='SkFont_Reference#Font'>font</a> kerning tables.
|
||||
|
||||
<a name='Linear'></a>
|
||||
|
||||
<a href='#Font_Linear'>Font_Linear</a> selects whether <a href='undocumented#Text'>text</a> is rendered as a <a href='undocumented#Glyph'>Glyph</a> or as a <a href='SkPath_Reference#Path'>Path</a>.
|
||||
If <a href='#Font_Linear'>Font_Linear</a> is set, it has the same effect as setting Hinting to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNormal'>kNormal</a>.
|
||||
If <a href='#Font_Linear'>Font_Linear</a> is clear, it is the same as setting Hinting to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNone'>kNone</a>.
|
||||
|
||||
<a name='Subpixel'></a>
|
||||
|
||||
<a href='#Font_Subpixel'>Font_Subpixel</a> uses the <a href='undocumented#Pixel'>pixel</a> transparency to represent a fractional offset.
|
||||
As the opaqueness of the <a href='SkColor_Reference#Color'>color</a> increases, the edge of the <a href='undocumented#Glyph'>glyph</a> appears to move
|
||||
towards the outside of the <a href='undocumented#Pixel'>pixel</a>.
|
||||
|
||||
<a name='Anti_Alias'></a>
|
||||
|
||||
When set, <a href='#Paint_Anti_Alias'>Anti_Alias</a> positions <a href='undocumented#Glyph'>glyphs</a> within a <a href='undocumented#Pixel'>pixel</a>, using <a href='SkColor_Reference#Alpha'>alpha</a> and
|
||||
possibly RGB striping. It can take advantage of the organization of RGB stripes
|
||||
that create a <a href='SkColor_Reference#Color'>color</a>, and relies on the small <a href='undocumented#Size'>size</a> of the stripe and visual perception
|
||||
to make the <a href='SkColor_Reference#Color'>color</a> fringing imperceptible.
|
||||
|
||||
<a href='#Paint_Anti_Alias'>Anti_Alias</a> can be enabled on devices that orient stripes horizontally
|
||||
or vertically, and that order the <a href='SkColor_Reference#Color'>color</a> components as RGB or BGR. Internally, the
|
||||
<a href='undocumented#Glyph'>glyph</a> cache may store multiple copies of the same <a href='undocumented#Glyph'>glyph</a> with different <a href='SkFont_Reference#Subpixel'>sub-pixel</a>
|
||||
positions, requiring more memory.
|
||||
|
||||
<a name='Force_Hinting'></a>
|
||||
|
||||
If Hinting is set to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNormal'>kNormal</a> or <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kFull'>kFull</a>, <a href='#Font_Force_Hinting'>Force_Hinting</a>
|
||||
instructs the <a href='#Font_Manager'>Font_Manager</a> to always hint <a href='undocumented#Glyph'>Glyphs</a>.
|
||||
<a href='#Font_Force_Hinting'>Force_Hinting</a> has no effect if Hinting is set to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNone'>kNone</a> or
|
||||
<a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kSlight'>kSlight</a>.
|
||||
|
||||
<a href='#Font_Force_Hinting'>Force_Hinting</a> only affects platforms that use FreeType as the <a href='#Font_Manager'>Font_Manager</a>.
|
||||
|
||||
<a name='Embedded_Bitmaps'></a>
|
||||
|
||||
<a href='#Font_Embedded_Bitmaps'>Embedded_Bitmaps</a> allows selecting custom sized <a href='SkBitmap_Reference#Bitmap'>bitmap</a> <a href='undocumented#Glyph'>Glyphs</a>.
|
||||
<a href='#Font_Embedded_Bitmaps'>Embedded_Bitmaps</a> when set chooses an embedded <a href='SkBitmap_Reference#Bitmap'>bitmap</a> <a href='undocumented#Glyph'>glyph</a> over an outline contained
|
||||
in a <a href='SkFont_Reference#Font'>font</a> if the platform supports this option.
|
||||
|
||||
FreeType selects the <a href='SkBitmap_Reference#Bitmap'>bitmap</a> <a href='undocumented#Glyph'>glyph</a> if available when <a href='#Font_Embedded_Bitmaps'>Embedded_Bitmaps</a> is set, and selects
|
||||
the outline <a href='undocumented#Glyph'>glyph</a> if <a href='#Font_Embedded_Bitmaps'>Embedded_Bitmaps</a> is clear.
|
||||
Windows may select the <a href='SkBitmap_Reference#Bitmap'>bitmap</a> <a href='undocumented#Glyph'>glyph</a> but is not required to do so.
|
||||
<a href='#OS_X'>OS_X</a> and iOS do not support this option.
|
||||
|
||||
<a name='SkFont'></a>
|
||||
|
||||
---
|
||||
@ -300,7 +393,7 @@ incomplete
|
||||
bool <a href='#SkFont_isSubpixel'>isSubpixel</a>()const
|
||||
</pre>
|
||||
|
||||
Returns true if <a href='undocumented#Glyph'>glyphs</a> at different sub-pixel positions may differ on <a href='undocumented#Pixel'>pixel</a> edge coverage.
|
||||
Returns true if <a href='undocumented#Glyph'>glyphs</a> at different <a href='SkFont_Reference#Subpixel'>sub-pixel</a> positions may differ on <a href='undocumented#Pixel'>pixel</a> edge coverage.
|
||||
|
||||
### Return Value
|
||||
|
||||
@ -420,12 +513,12 @@ incomplete
|
||||
void <a href='#SkFont_setSubpixel'>setSubpixel</a>(bool subpixel)
|
||||
</pre>
|
||||
|
||||
Requests, but does not require, that <a href='undocumented#Glyph'>glyphs</a> respect sub-pixel positioning.
|
||||
Requests, but does not require, that <a href='undocumented#Glyph'>glyphs</a> respect <a href='SkFont_Reference#Subpixel'>sub-pixel</a> positioning.
|
||||
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name='SkFont_setSubpixel_subpixel'><code><strong>subpixel</strong></code></a></td>
|
||||
<td>setting for sub-pixel positioning</td>
|
||||
<td>setting for <a href='SkFont_Reference#Subpixel'>sub-pixel</a> positioning</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -991,7 +1084,7 @@ Returns true if <a href='#SkFont_containsText_byteLength'>byteLength</a> is zero
|
||||
<td>number of bytes in <a href='#SkFont_containsText_text'>text</a> array</td>
|
||||
</tr>
|
||||
<tr> <td><a name='SkFont_containsText_encoding'><code><strong>encoding</strong></code></a></td>
|
||||
<td><a href='#SkFont_containsText_text'>text</a> <a href='#SkFont_containsText_encoding'>encoding</a></td>
|
||||
<td><a href='undocumented#Text_Encoding'>text encoding</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -1020,7 +1113,7 @@ Returns the bytes of <a href='#SkFont_breakText_text'>text</a> that fit within <
|
||||
The <a href='#SkFont_breakText_text'>text</a> fragment fits if its advance width is less than or equal to <a href='#SkFont_breakText_maxWidth'>maxWidth</a>.
|
||||
Measures only while the advance is less than or equal to <a href='#SkFont_breakText_maxWidth'>maxWidth</a>.
|
||||
Returns the advance or the <a href='#SkFont_breakText_text'>text</a> fragment in <a href='#SkFont_breakText_measuredWidth'>measuredWidth</a> if it not nullptr.
|
||||
Uses <a href='#SkFont_breakText_encoding'>encoding</a> to decode <a href='#SkFont_breakText_text'>text</a>, <a href='undocumented#SkTypeface'>SkTypeface</a> to get the <a href='SkFont_Reference#Font'>font</a> metrics,
|
||||
Uses <a href='#SkFont_breakText_encoding'>encoding</a> to decode <a href='#SkFont_breakText_text'>text</a>, <a href='undocumented#SkTypeface'>SkTypeface</a> to get the <a href='undocumented#Font_Metrics'>font metrics</a>,
|
||||
and <a href='#SkFont_breakText_text'>text</a> <a href='undocumented#Size'>size</a> 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.
|
||||
<td>number of bytes of <a href='#SkFont_breakText_text'>text</a> to measure</td>
|
||||
</tr>
|
||||
<tr> <td><a name='SkFont_breakText_encoding'><code><strong>encoding</strong></code></a></td>
|
||||
<td><a href='#SkFont_breakText_text'>text</a> <a href='#SkFont_breakText_encoding'>encoding</a></td>
|
||||
<td><a href='undocumented#Text_Encoding'>text encoding</a></td>
|
||||
</tr>
|
||||
<tr> <td><a name='SkFont_breakText_maxWidth'><code><strong>maxWidth</strong></code></a></td>
|
||||
<td>advance limit; <a href='#SkFont_breakText_text'>text</a> is measured while advance is less than <a href='#SkFont_breakText_maxWidth'>maxWidth</a></td>
|
||||
|
@ -131,16 +131,8 @@ class <a href='SkPaint_Reference#SkPaint'>SkPaint</a> {
|
||||
void <a href='#SkPaint_setTextScaleX'>setTextScaleX</a>(<a href='undocumented#SkScalar'>SkScalar</a> scaleX);
|
||||
<a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkPaint_getTextSkewX'>getTextSkewX</a>() const;
|
||||
void <a href='#SkPaint_setTextSkewX'>setTextSkewX</a>(<a href='undocumented#SkScalar'>SkScalar</a> skewX);
|
||||
|
||||
enum <a href='#SkPaint_TextEncoding'>TextEncoding</a> : uint8_t {
|
||||
<a href='#SkPaint_kUTF8_TextEncoding'>kUTF8_TextEncoding</a>,
|
||||
<a href='#SkPaint_kUTF16_TextEncoding'>kUTF16_TextEncoding</a>,
|
||||
<a href='#SkPaint_kUTF32_TextEncoding'>kUTF32_TextEncoding</a>,
|
||||
<a href='#SkPaint_kGlyphID_TextEncoding'>kGlyphID_TextEncoding</a>,
|
||||
};
|
||||
|
||||
<a href='#SkPaint_TextEncoding'>TextEncoding</a> <a href='#SkPaint_getTextEncoding'>getTextEncoding</a>() const;
|
||||
void <a href='#SkPaint_setTextEncoding'>setTextEncoding</a>(<a href='#SkPaint_TextEncoding'>TextEncoding</a> encoding);
|
||||
<a href='undocumented#SkTextEncoding'>SkTextEncoding</a> <a href='#SkPaint_getTextEncoding'>getTextEncoding</a>() const;
|
||||
void <a href='#SkPaint_setTextEncoding'>setTextEncoding</a>(<a href='undocumented#SkTextEncoding'>SkTextEncoding</a> encoding);
|
||||
|
||||
typedef <a href='undocumented#SkFontMetrics'>SkFontMetrics</a> <a href='#SkPaint_FontMetrics'>FontMetrics</a>;
|
||||
|
||||
@ -219,29 +211,29 @@ Constructs <a href='SkPaint_Reference#Paint'>Paint</a> with default values.
|
||||
| <a href='#Color_Filter'>Color_Filter</a> | nullptr |
|
||||
| Dither | false |
|
||||
| <a href='#Draw_Looper'>Draw_Looper</a> | nullptr |
|
||||
| <a href='#Paint_Fake_Bold'>Fake_Bold</a> | false |
|
||||
| <a href='#Filter_Quality'>Filter_Quality</a> | <a href='undocumented#kNone_SkFilterQuality'>kNone_SkFilterQuality</a> |
|
||||
| <a href='#Paint_Font_Embedded_Bitmaps'>Font_Embedded_Bitmaps</a> | false |
|
||||
| <a href='#Paint_Automatic_Hinting'>Automatic_Hinting</a> | false |
|
||||
| <a href='#Paint_Full_Hinting_Spacing'>Full_Hinting_Spacing</a> | false |
|
||||
| Hinting | <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNormal'>kNormal</a> |
|
||||
| <a href='#Font_Force_Hinting'>Font_Force_Hinting</a> | false |
|
||||
| <a href='#Font_Embedded_Bitmaps'>Font_Embedded_Bitmaps</a> | false |
|
||||
| <a href='#Font_Embolden'>Font_Embolden</a> | false |
|
||||
| <a href='#Font_Hinting'>Font_Hinting</a> | <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNormal'>kNormal</a> |
|
||||
| <a href='#Font_Hinting_Spacing'>Font_Hinting_Spacing</a> | false |
|
||||
| <a href='#Font_Anti_Alias'>Font_Anti_Alias</a> | false |
|
||||
| <a href='#Font_Linear'>Font_Linear</a> | false |
|
||||
| <a href='#Font_Scale_X'>Font_Scale_X</a> | 1 |
|
||||
| <a href='#Font_Size'>Font_Size</a> | 12 |
|
||||
| <a href='#Font_Skew_X'>Font_Skew_X</a> | 0 |
|
||||
| <a href='#Font_Subpixel'>Font_Subpixel</a> | false |
|
||||
| <a href='#Image_Filter'>Image_Filter</a> | nullptr |
|
||||
| <a href='#Paint_LCD_Text'>LCD_Text</a> | false |
|
||||
| <a href='#Paint_Linear_Text'>Linear_Text</a> | false |
|
||||
| <a href='#Paint_Miter_Limit'>Miter_Limit</a> | 4 |
|
||||
| <a href='#Mask_Filter'>Mask_Filter</a> | nullptr |
|
||||
| <a href='#Path_Effect'>Path_Effect</a> | nullptr |
|
||||
| <a href='undocumented#Shader'>Shader</a> | nullptr |
|
||||
| <a href='#SkPaint_Style'>Style</a> | <a href='#SkPaint_kFill_Style'>kFill_Style</a> |
|
||||
| <a href='#Paint_Text_Encoding'>Text_Encoding</a> | <a href='#SkPaint_kUTF8_TextEncoding'>kUTF8_TextEncoding</a> |
|
||||
| <a href='#Paint_Text_Scale_X'>Text_Scale_X</a> | 1 |
|
||||
| <a href='#Paint_Text_Size'>Text_Size</a> | 12 |
|
||||
| <a href='#Paint_Text_Skew_X'>Text_Skew_X</a> | 0 |
|
||||
| <a href='#Text_Encoding'>Text_Encoding</a> | <a href='undocumented#kUTF8_SkTextEncoding'>kUTF8_SkTextEncoding</a> |
|
||||
| <a href='undocumented#Typeface'>Typeface</a> | nullptr |
|
||||
| <a href='#Paint_Stroke_Cap'>Stroke_Cap</a> | <a href='#SkPaint_kButt_Cap'>kButt_Cap</a> |
|
||||
| <a href='#Paint_Stroke_Join'>Stroke_Join</a> | <a href='#SkPaint_kMiter_Join'>kMiter_Join</a> |
|
||||
| <a href='#Paint_Stroke_Width'>Stroke_Width</a> | 0 |
|
||||
| <a href='#Paint_Subpixel_Text'>Subpixel_Text</a> | false |
|
||||
|
||||
The flags, <a href='undocumented#Text'>text</a> <a href='undocumented#Size'>size</a>, hinting, and miter limit may be overridden at compile time by defining
|
||||
<a href='SkPaint_Reference#Paint'>paint</a> default values. The overrides may be included in "SkUserConfig.h" or predefined by the
|
||||
@ -678,25 +670,25 @@ mask for setting Dither</td>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kFakeBoldText_Flag'><code>SkPaint::kFakeBoldText_Flag</code></a></td>
|
||||
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0x0020</td>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
|
||||
mask for setting Fake_Bold</td>
|
||||
mask for setting Font_Embolden</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kLinearText_Flag'><code>SkPaint::kLinearText_Flag</code></a></td>
|
||||
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0x0040</td>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
|
||||
mask for setting Linear_Text</td>
|
||||
mask for setting Font_Linear</td>
|
||||
</tr>
|
||||
<tr style='background-color: #f0f0f0; '>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kSubpixelText_Flag'><code>SkPaint::kSubpixelText_Flag</code></a></td>
|
||||
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0x0080</td>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
|
||||
mask for setting Subpixel_Text</td>
|
||||
mask for setting Font_Subpixel</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kLCDRenderText_Flag'><code>SkPaint::kLCDRenderText_Flag</code></a></td>
|
||||
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0x0200</td>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
|
||||
mask for setting LCD_Text</td>
|
||||
mask for setting Font_Anti_Alias</td>
|
||||
</tr>
|
||||
<tr style='background-color: #f0f0f0; '>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kEmbeddedBitmapText_Flag'><code>SkPaint::kEmbeddedBitmapText_Flag</code></a></td>
|
||||
@ -708,7 +700,7 @@ mask for setting Font_Embedded_Bitmaps</td>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kAutoHinting_Flag'><code>SkPaint::kAutoHinting_Flag</code></a></td>
|
||||
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0x0800</td>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
|
||||
mask for setting Automatic_Hinting</td>
|
||||
mask for setting Font_Force_Hinting</td>
|
||||
</tr>
|
||||
<tr style='background-color: #f0f0f0; '>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kAllFlags'><code>SkPaint::kAllFlags</code></a></td>
|
||||
@ -979,12 +971,12 @@ paint1 == paint2
|
||||
|
||||
---
|
||||
|
||||
<a href='#Paint_LCD_Text'>LCD_Text</a> and <a href='#Paint_Subpixel_Text'>Subpixel_Text</a> increase the precision of <a href='undocumented#Glyph'>glyph</a> position.
|
||||
<a href='#Font_Anti_Alias'>Font_Anti_Alias</a> and <a href='#Font_Subpixel'>Font_Subpixel</a> increase the precision of <a href='undocumented#Glyph'>glyph</a> position.
|
||||
|
||||
When set, <a href='#SkPaint_Flags'>Flags</a> <a href='#SkPaint_kLCDRenderText_Flag'>kLCDRenderText_Flag</a> takes advantage of the organization of RGB stripes that
|
||||
create a <a href='SkColor_Reference#Color'>color</a>, and relies
|
||||
on the small <a href='undocumented#Size'>size</a> of the stripe and visual perception to make the <a href='SkColor_Reference#Color'>color</a> fringing imperceptible.
|
||||
<a href='#Paint_LCD_Text'>LCD_Text</a> can be enabled on devices that orient stripes horizontally or vertically, and that order
|
||||
<a href='#Font_Anti_Alias'>Font_Anti_Alias</a> can be enabled on devices that orient stripes horizontally or vertically, and that order
|
||||
the <a href='SkColor_Reference#Color'>color</a> components as RGB or BGR.
|
||||
|
||||
<a href='#SkPaint_Flags'>Flags</a> <a href='#SkPaint_kSubpixelText_Flag'>kSubpixelText_Flag</a> uses the <a href='undocumented#Pixel'>pixel</a> transparency to represent a fractional offset.
|
||||
@ -993,21 +985,21 @@ of the <a href='SkColor_Reference#Color'>color</a> increases, the edge of the <a
|
||||
|
||||
Either or both techniques can be enabled.
|
||||
<a href='#SkPaint_kLCDRenderText_Flag'>kLCDRenderText_Flag</a> and <a href='#SkPaint_kSubpixelText_Flag'>kSubpixelText_Flag</a> are clear by default.
|
||||
<a href='#Paint_LCD_Text'>LCD_Text</a> or <a href='#Paint_Subpixel_Text'>Subpixel_Text</a> can be enabled by default by setting <a href='undocumented#SkPaintDefaults_Flags'>SkPaintDefaults_Flags</a> to
|
||||
<a href='#Font_Anti_Alias'>Font_Anti_Alias</a> or <a href='#Font_Subpixel'>Font_Subpixel</a> can be enabled by default by setting <a href='undocumented#SkPaintDefaults_Flags'>SkPaintDefaults_Flags</a> to
|
||||
<a href='#SkPaint_kLCDRenderText_Flag'>kLCDRenderText_Flag</a> or <a href='#SkPaint_kSubpixelText_Flag'>kSubpixelText_Flag</a> (or both) at compile time.
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="4606ae1be792d6bc46d496432f050ee9"><div>Four commas are drawn normally and with combinations of <a href='#Paint_LCD_Text'>LCD_Text</a> and <a href='#Paint_Subpixel_Text'>Subpixel_Text</a>.
|
||||
When <a href='#Paint_Subpixel_Text'>Subpixel_Text</a> is disabled, the comma <a href='undocumented#Glyph'>Glyphs</a> are identical, but not evenly spaced.
|
||||
When <a href='#Paint_Subpixel_Text'>Subpixel_Text</a> is enabled, the comma <a href='undocumented#Glyph'>Glyphs</a> are unique, but appear evenly spaced.
|
||||
<div><fiddle-embed name="4606ae1be792d6bc46d496432f050ee9"><div>Four commas are drawn normally and with combinations of <a href='#Font_Anti_Alias'>Font_Anti_Alias</a> and <a href='#Font_Subpixel'>Font_Subpixel</a>.
|
||||
When <a href='#Font_Subpixel'>Font_Subpixel</a> is disabled, the comma <a href='undocumented#Glyph'>Glyphs</a> are identical, but not evenly spaced.
|
||||
When <a href='#Font_Subpixel'>Font_Subpixel</a> is enabled, the comma <a href='undocumented#Glyph'>Glyphs</a> are unique, but appear evenly spaced.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
<a name='Linear_Text'></a>
|
||||
|
||||
<a href='#Paint_Linear_Text'>Linear_Text</a> selects whether <a href='undocumented#Text'>text</a> is rendered as a <a href='undocumented#Glyph'>Glyph</a> or as a <a href='SkPath_Reference#Path'>Path</a>.
|
||||
If <a href='#SkPaint_kLinearText_Flag'>kLinearText_Flag</a> is set, it has the same effect as setting Hinting to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNormal'>kNormal</a>.
|
||||
If <a href='#SkPaint_kLinearText_Flag'>kLinearText_Flag</a> is clear, it is the same as setting Hinting to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNone'>kNone</a>.
|
||||
<a href='#Font_Linear'>Font_Linear</a> selects whether <a href='undocumented#Text'>text</a> is rendered as a <a href='undocumented#Glyph'>Glyph</a> or as a <a href='SkPath_Reference#Path'>Path</a>.
|
||||
If <a href='#Font_Linear'>Font_Linear</a> is set, it has the same effect as setting Hinting to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNormal'>kNormal</a>.
|
||||
If <a href='#Font_Linear'>Font_Linear</a> is clear, it is the same as setting Hinting to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNone'>kNone</a>.
|
||||
|
||||
<a name='SkPaint_isLinearText'></a>
|
||||
|
||||
@ -1077,7 +1069,7 @@ of the <a href='SkColor_Reference#Color'>color</a> increases, the edge of the <a
|
||||
bool <a href='#SkPaint_isSubpixelText'>isSubpixelText</a>()const
|
||||
</pre>
|
||||
|
||||
Returns true if <a href='undocumented#Glyph'>glyphs</a> at different sub-pixel positions may differ on <a href='undocumented#Pixel'>pixel</a> edge coverage.
|
||||
Returns true if <a href='undocumented#Glyph'>glyphs</a> at different <a href='SkFont_Reference#Subpixel'>sub-pixel</a> positions may differ on <a href='undocumented#Pixel'>pixel</a> edge coverage.
|
||||
|
||||
Equivalent to <a href='#SkPaint_getFlags'>getFlags</a>() masked with <a href='#SkPaint_kSubpixelText_Flag'>kSubpixelText_Flag</a>.
|
||||
|
||||
@ -1106,7 +1098,7 @@ paint.isSubpixelText() == !!(paint.getFlags() & SkPaint::kSubpixelText_Flag)
|
||||
void <a href='#SkPaint_setSubpixelText'>setSubpixelText</a>(bool subpixelText)
|
||||
</pre>
|
||||
|
||||
Requests, but does not require, that <a href='undocumented#Glyph'>glyphs</a> respect sub-pixel positioning.
|
||||
Requests, but does not require, that <a href='undocumented#Glyph'>glyphs</a> respect <a href='SkFont_Reference#Subpixel'>sub-pixel</a> positioning.
|
||||
|
||||
Sets <a href='#SkPaint_kSubpixelText_Flag'>kSubpixelText_Flag</a> if <a href='#SkPaint_setSubpixelText_subpixelText'>subpixelText</a> is true.
|
||||
Clears <a href='#SkPaint_kSubpixelText_Flag'>kSubpixelText_Flag</a> if <a href='#SkPaint_setSubpixelText_subpixelText'>subpixelText</a> is false.
|
||||
@ -1132,10 +1124,10 @@ paint1 == paint2
|
||||
|
||||
<a name='LCD_Text'></a>
|
||||
|
||||
When set, <a href='#SkPaint_Flags'>Flags</a> <a href='#SkPaint_kLCDRenderText_Flag'>kLCDRenderText_Flag</a> takes advantage of the organization of RGB stripes that
|
||||
When set, <a href='#Font_Anti_Alias'>Font_Anti_Alias</a> takes advantage of the organization of RGB stripes that
|
||||
create a <a href='SkColor_Reference#Color'>color</a>, and relies
|
||||
on the small <a href='undocumented#Size'>size</a> of the stripe and visual perception to make the <a href='SkColor_Reference#Color'>color</a> fringing imperceptible.
|
||||
<a href='#Paint_LCD_Text'>LCD_Text</a> can be enabled on devices that orient stripes horizontally or vertically, and that order
|
||||
<a href='#Font_Anti_Alias'>Font_Anti_Alias</a> can be enabled on devices that orient stripes horizontally or vertically, and that order
|
||||
the <a href='SkColor_Reference#Color'>color</a> components as RGB or BGR.
|
||||
|
||||
<a name='SkPaint_isLCDRenderText'></a>
|
||||
@ -1199,11 +1191,11 @@ paint1 == paint2
|
||||
|
||||
</fiddle-embed></div>
|
||||
|
||||
<a name='Font_Embedded_Bitmaps'></a>
|
||||
<a name='Embedded_Bitmaps'></a>
|
||||
|
||||
---
|
||||
|
||||
<a href='#Paint_Font_Embedded_Bitmaps'>Font_Embedded_Bitmaps</a> allows selecting custom sized <a href='SkBitmap_Reference#Bitmap'>bitmap</a> <a href='undocumented#Glyph'>Glyphs</a>.
|
||||
<a href='#Font_Embedded_Bitmaps'>Font_Embedded_Bitmaps</a> allows selecting custom sized <a href='SkBitmap_Reference#Bitmap'>bitmap</a> <a href='undocumented#Glyph'>Glyphs</a>.
|
||||
<a href='#SkPaint_Flags'>Flags</a> <a href='#SkPaint_kEmbeddedBitmapText_Flag'>kEmbeddedBitmapText_Flag</a> when set chooses an embedded <a href='SkBitmap_Reference#Bitmap'>bitmap</a> <a href='undocumented#Glyph'>glyph</a> over an outline contained
|
||||
in a <a href='SkFont_Reference#Font'>font</a> if the platform supports this option.
|
||||
|
||||
@ -1212,8 +1204,8 @@ the outline <a href='undocumented#Glyph'>glyph</a> if <a href='#SkPaint_kEmbedde
|
||||
Windows may select the <a href='SkBitmap_Reference#Bitmap'>bitmap</a> <a href='undocumented#Glyph'>glyph</a> but is not required to do so.
|
||||
<a href='#OS_X'>OS_X</a> and iOS do not support this option.
|
||||
|
||||
<a href='#Paint_Font_Embedded_Bitmaps'>Font_Embedded_Bitmaps</a> is disabled by default.
|
||||
<a href='#Paint_Font_Embedded_Bitmaps'>Font_Embedded_Bitmaps</a> can be enabled by default by setting <a href='undocumented#SkPaintDefaults_Flags'>SkPaintDefaults_Flags</a> to
|
||||
<a href='#Font_Embedded_Bitmaps'>Font_Embedded_Bitmaps</a> is disabled by default.
|
||||
<a href='#Font_Embedded_Bitmaps'>Font_Embedded_Bitmaps</a> can be enabled by default by setting <a href='undocumented#SkPaintDefaults_Flags'>SkPaintDefaults_Flags</a> to
|
||||
<a href='#SkPaint_kEmbeddedBitmapText_Flag'>kEmbeddedBitmapText_Flag</a> at compile time.
|
||||
|
||||
### Example
|
||||
@ -1304,12 +1296,12 @@ paint1 == paint2
|
||||
|
||||
<a name='Automatic_Hinting'></a>
|
||||
|
||||
If Hinting is set to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNormal'>kNormal</a> or <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kFull'>kFull</a>, <a href='#Paint_Automatic_Hinting'>Automatic_Hinting</a>
|
||||
If Hinting is set to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNormal'>kNormal</a> or <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kFull'>kFull</a>, <a href='#Font_Force_Hinting'>Font_Force_Hinting</a>
|
||||
instructs the <a href='#Font_Manager'>Font_Manager</a> to always hint <a href='undocumented#Glyph'>Glyphs</a>.
|
||||
<a href='#Paint_Automatic_Hinting'>Automatic_Hinting</a> has no effect if Hinting is set to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNone'>kNone</a> or
|
||||
<a href='#Font_Force_Hinting'>Font_Force_Hinting</a> has no effect if Hinting is set to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNone'>kNone</a> or
|
||||
<a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kSlight'>kSlight</a>.
|
||||
|
||||
<a href='#Paint_Automatic_Hinting'>Automatic_Hinting</a> only affects platforms that use FreeType as the <a href='#Font_Manager'>Font_Manager</a>.
|
||||
<a href='#Font_Force_Hinting'>Font_Force_Hinting</a> only affects platforms that use FreeType as the <a href='#Font_Manager'>Font_Manager</a>.
|
||||
|
||||
<a name='SkPaint_isAutohinted'></a>
|
||||
|
||||
@ -1357,7 +1349,7 @@ void <a href='#SkPaint_setAutohinted'>setAutohinted</a>(bool useAutohinter)
|
||||
Sets whether to always hint <a href='undocumented#Glyph'>glyphs</a>.
|
||||
If <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::Hinting is set to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNormal'>kNormal</a> or <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kFull'>kFull</a>
|
||||
and <a href='#SkPaint_setAutohinted_useAutohinter'>useAutohinter</a> is set, instructs the <a href='undocumented#Font_Manager'>font manager</a> to always hint <a href='undocumented#Glyph'>glyphs</a>.
|
||||
<a href='SkPaint_Reference#Automatic_Hinting'>auto-hinting</a> has no effect if <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::Hinting is set to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNone'>kNone</a> or
|
||||
<a href='#SkPaint_setAutohinted_useAutohinter'>useAutohinter</a> has no effect if <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::Hinting is set to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNone'>kNone</a> or
|
||||
<a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kSlight'>kSlight</a>.
|
||||
|
||||
Only affects platforms that use FreeType as the <a href='undocumented#Font_Manager'>font manager</a>.
|
||||
@ -1384,7 +1376,7 @@ Clears <a href='#SkPaint_kAutoHinting_Flag'>kAutoHinting_Flag</a> if <a href='#S
|
||||
|
||||
---
|
||||
|
||||
<a href='#Paint_Fake_Bold'>Fake_Bold</a> approximates the bold <a href='SkFont_Reference#Font'>font</a> style accompanying a normal <a href='SkFont_Reference#Font'>font</a> when a bold <a href='SkFont_Reference#Font'>font</a> face
|
||||
<a href='#Font_Embolden'>Font_Embolden</a> approximates the bold <a href='SkFont_Reference#Font'>font</a> style accompanying a normal <a href='SkFont_Reference#Font'>font</a> when a bold <a href='SkFont_Reference#Font'>font</a> face
|
||||
is not available. Skia does not provide <a href='SkFont_Reference#Font'>font</a> substitution; it is up to the client to find the
|
||||
bold <a href='SkFont_Reference#Font'>font</a> face using the platform <a href='#Font_Manager'>Font_Manager</a>.
|
||||
|
||||
@ -1395,7 +1387,7 @@ A FreeType based port may define SK_USE_FREETYPE_EMBOLDEN at compile time to dir
|
||||
the <a href='SkFont_Reference#Font_Engine'>font engine</a> to create the bold <a href='undocumented#Glyph'>Glyphs</a>. Otherwise, the extra bold is computed
|
||||
by increasing the <a href='#Stroke_Width'>stroke width</a> and setting the <a href='#SkPaint_Style'>Style</a> to <a href='#SkPaint_kStrokeAndFill_Style'>kStrokeAndFill_Style</a> as needed.
|
||||
|
||||
<a href='#Paint_Fake_Bold'>Fake_Bold</a> is disabled by default.
|
||||
<a href='#Font_Embolden'>Font_Embolden</a> is disabled by default.
|
||||
|
||||
### Example
|
||||
|
||||
@ -1463,16 +1455,6 @@ paint1 == paint2
|
||||
|
||||
</fiddle-embed></div>
|
||||
|
||||
<a name='Full_Hinting_Spacing'></a>
|
||||
|
||||
if Hinting is set to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kFull'>kFull</a>, <a href='#Paint_Full_Hinting_Spacing'>Full_Hinting_Spacing</a> adjusts the character
|
||||
spacing by the difference of the hinted and unhinted <a href='#Left_Side_Bearing'>Left_Side_Bearing</a> and
|
||||
<a href='#Right_Side_Bearing'>Right_Side_Bearing</a>. <a href='#Paint_Full_Hinting_Spacing'>Full_Hinting_Spacing</a> only applies to platforms that use
|
||||
FreeType as their <a href='#Font_Engine'>Font_Engine</a>.
|
||||
|
||||
<a href='#Paint_Full_Hinting_Spacing'>Full_Hinting_Spacing</a> is not related to <a href='undocumented#Text'>text</a> kerning, where the space between
|
||||
a specific pair of characters is adjusted using <a href='undocumented#Data'>data</a> in the <a href='SkFont_Reference#Font'>font</a> kerning tables.
|
||||
|
||||
<a name='Filter_Quality_Methods'></a>
|
||||
|
||||
---
|
||||
@ -3577,74 +3559,9 @@ Default value is zero.
|
||||
|
||||
---
|
||||
|
||||
<a name='SkPaint_TextEncoding'></a>
|
||||
|
||||
---
|
||||
|
||||
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
|
||||
enum <a href='#SkPaint_TextEncoding'>TextEncoding</a> : uint8_t {
|
||||
<a href='#SkPaint_kUTF8_TextEncoding'>kUTF8_TextEncoding</a>,
|
||||
<a href='#SkPaint_kUTF16_TextEncoding'>kUTF16_TextEncoding</a>,
|
||||
<a href='#SkPaint_kUTF32_TextEncoding'>kUTF32_TextEncoding</a>,
|
||||
<a href='#SkPaint_kGlyphID_TextEncoding'>kGlyphID_TextEncoding</a>,
|
||||
};
|
||||
|
||||
</pre>
|
||||
|
||||
<a href='#SkPaint_TextEncoding'>TextEncoding</a> determines whether <a href='undocumented#Text'>text</a> specifies character codes and their encoded
|
||||
<a href='undocumented#Size'>size</a>, or <a href='undocumented#Glyph'>glyph</a> indices. Characters are encoded as specified by the
|
||||
<a href='https://unicode.org/standard/standard.html'>Unicode standard</a></a> .
|
||||
|
||||
Character codes encoded <a href='undocumented#Size'>size</a> 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.
|
||||
|
||||
<a href='https://tools.ietf.org/html/rfc3629'>UTF-8 (RFC 3629)</a></a> encodes each character as one or more 8-bit bytes.
|
||||
|
||||
<a href='https://tools.ietf.org/html/rfc2781'>UTF-16 (RFC 2781)</a></a> encodes each character as one or two 16-bit words.
|
||||
|
||||
<a href='https://www.unicode.org/versions/Unicode5.0.0/ch03.pdf'>UTF-32</a></a> encodes each character as one 32-bit word.
|
||||
|
||||
<a href='#Font_Manager'>Font_Manager</a> uses <a href='SkFont_Reference#Font'>font</a> <a href='undocumented#Data'>data</a> to convert character code <a href='SkPoint_Reference#Point'>points</a> into <a href='undocumented#Glyph'>glyph</a> indices.
|
||||
A <a href='undocumented#Glyph'>glyph</a> index is a 16-bit word.
|
||||
|
||||
<a href='#SkPaint_TextEncoding'>TextEncoding</a> is set to <a href='#SkPaint_kUTF8_TextEncoding'>kUTF8_TextEncoding</a> by default.
|
||||
|
||||
### Constants
|
||||
|
||||
<table style='border-collapse: collapse; width: 62.5em'>
|
||||
<tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Const</th>
|
||||
<th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th>
|
||||
<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr>
|
||||
<tr style='background-color: #f0f0f0; '>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kUTF8_TextEncoding'><code>SkPaint::kUTF8_TextEncoding</code></a></td>
|
||||
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0</td>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
|
||||
uses bytes to represent UTF-8 or ASCII</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kUTF16_TextEncoding'><code>SkPaint::kUTF16_TextEncoding</code></a></td>
|
||||
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>1</td>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
|
||||
uses two byte words to represent most of Unicode</td>
|
||||
</tr>
|
||||
<tr style='background-color: #f0f0f0; '>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kUTF32_TextEncoding'><code>SkPaint::kUTF32_TextEncoding</code></a></td>
|
||||
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>2</td>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
|
||||
uses four byte words to represent all of Unicode</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kGlyphID_TextEncoding'><code>SkPaint::kGlyphID_TextEncoding</code></a></td>
|
||||
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>3</td>
|
||||
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
|
||||
uses two byte words to represent glyph indices</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="b29294e7f29d160a1b46abf2dcec9d2a"><div>First <a href='undocumented#Line'>line</a> is encoded in UTF-8.
|
||||
<div><fiddle-embed name="767fa4e7b6300e16a419f9881f0f9d3d"><div>First <a href='undocumented#Line'>line</a> is encoded in UTF-8.
|
||||
Second <a href='undocumented#Line'>line</a> is encoded in UTF-16.
|
||||
Third <a href='undocumented#Line'>line</a> is encoded in UTF-32.
|
||||
Fourth <a href='undocumented#Line'>line</a> has 16-bit <a href='undocumented#Glyph'>glyph</a> indices.
|
||||
@ -3655,27 +3572,25 @@ Fourth <a href='undocumented#Line'>line</a> has 16-bit <a href='undocumented#Gly
|
||||
---
|
||||
|
||||
<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
|
||||
<a href='#SkPaint_TextEncoding'>TextEncoding</a> <a href='#SkPaint_getTextEncoding'>getTextEncoding</a>()const
|
||||
<a href='undocumented#SkTextEncoding'>SkTextEncoding</a> <a href='#SkPaint_getTextEncoding'>getTextEncoding</a>()const
|
||||
</pre>
|
||||
|
||||
Returns <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_TextEncoding'>TextEncoding</a>.
|
||||
<a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_TextEncoding'>TextEncoding</a> determines how character code <a href='SkPoint_Reference#Point'>points</a> are mapped to <a href='SkFont_Reference#Font'>font</a> <a href='undocumented#Glyph'>glyph</a> indices.
|
||||
Returns the <a href='undocumented#Text'>text</a> encoding. <a href='undocumented#Text'>Text</a> encoding describes how to interpret the <a href='undocumented#Text'>text</a> bytes pass
|
||||
to methods like <a href='#SkPaint_measureText'>measureText</a>() and <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_drawText'>drawText</a>().
|
||||
|
||||
### Return Value
|
||||
|
||||
one of: <a href='#SkPaint_kUTF8_TextEncoding'>kUTF8_TextEncoding</a>, <a href='#SkPaint_kUTF16_TextEncoding'>kUTF16_TextEncoding</a>, <a href='#SkPaint_kUTF32_TextEncoding'>kUTF32_TextEncoding</a>, or
|
||||
|
||||
<a href='#SkPaint_kGlyphID_TextEncoding'>kGlyphID_TextEncoding</a>
|
||||
the <a href='undocumented#Text'>text</a> encoding
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="c6cc2780a9828b3af8c4621c12b29a1b">
|
||||
<div><fiddle-embed name="0d21e968e9a4c78c902ae3ef494941a0">
|
||||
|
||||
#### Example Output
|
||||
|
||||
~~~~
|
||||
kUTF8_TextEncoding == text encoding
|
||||
kGlyphID_TextEncoding == text encoding
|
||||
kUTF8_SkTextEncoding == text encoding
|
||||
kGlyphID_SkTextEncoding == text encoding
|
||||
~~~~
|
||||
|
||||
</fiddle-embed></div>
|
||||
@ -3685,25 +3600,22 @@ kGlyphID_TextEncoding == text encoding
|
||||
---
|
||||
|
||||
<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
|
||||
void <a href='#SkPaint_setTextEncoding'>setTextEncoding</a>(<a href='#SkPaint_TextEncoding'>TextEncoding</a> encoding)
|
||||
void <a href='#SkPaint_setTextEncoding'>setTextEncoding</a>(<a href='undocumented#SkTextEncoding'>SkTextEncoding</a> encoding)
|
||||
</pre>
|
||||
|
||||
Sets <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_TextEncoding'>TextEncoding</a> to <a href='#SkPaint_setTextEncoding_encoding'>encoding</a>.
|
||||
<a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_TextEncoding'>TextEncoding</a> determines how character code <a href='SkPoint_Reference#Point'>points</a> are mapped to <a href='SkFont_Reference#Font'>font</a> <a href='undocumented#Glyph'>glyph</a> indices.
|
||||
Invalid values for <a href='#SkPaint_setTextEncoding_encoding'>encoding</a> are ignored.
|
||||
Sets the <a href='#Text_Encoding'>text encoding</a>. <a href='undocumented#Text'>Text</a> <a href='#SkPaint_setTextEncoding_encoding'>encoding</a> describes how to interpret the <a href='undocumented#Text'>text</a> bytes pass
|
||||
to methods like <a href='#SkPaint_measureText'>measureText</a>() and <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_drawText'>drawText</a>().
|
||||
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name='SkPaint_setTextEncoding_encoding'><code><strong>encoding</strong></code></a></td>
|
||||
<td>one of: <a href='#SkPaint_kUTF8_TextEncoding'>kUTF8_TextEncoding</a>, <a href='#SkPaint_kUTF16_TextEncoding'>kUTF16_TextEncoding</a>, <a href='#SkPaint_kUTF32_TextEncoding'>kUTF32_TextEncoding</a>, or</td>
|
||||
<td>the new <a href='#Text_Encoding'>text encoding</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<a href='#SkPaint_kGlyphID_TextEncoding'>kGlyphID_TextEncoding</a>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="6d9ffdd3c5543e9f12972a06dd4a0ce5">
|
||||
<div><fiddle-embed name="a5d1ba0dbf42afb797ffdb07647b5cb9">
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -3752,7 +3664,7 @@ recommended spacing between <a href='undocumented#Line'>lines</a>
|
||||
|
||||
### See Also
|
||||
|
||||
<a href='#Paint_Text_Size'>Text_Size</a> <a href='undocumented#Typeface'>Typeface</a> <a href='#Paint_Typeface_Methods'>Typeface_Methods</a>
|
||||
<a href='#Font_Size'>Font_Size</a> <a href='undocumented#Typeface'>Typeface</a> <a href='#Paint_Typeface_Methods'>Typeface_Methods</a>
|
||||
|
||||
<a name='SkPaint_getFontSpacing'></a>
|
||||
|
||||
@ -3827,7 +3739,7 @@ number of <a href='#SkPaint_textToGlyphs_glyphs'>glyphs</a> represented by <a hr
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="343e9471a7f7b5f09abdc3b44983433b"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="d11136d8a74f63009da2a7f550710823"></fiddle-embed></div>
|
||||
|
||||
<a name='SkPaint_countText'></a>
|
||||
|
||||
@ -3912,7 +3824,7 @@ corresponding to the Unicode surrogate code <a href='SkPoint_Reference#Point'>po
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="083557b6f653d6fc00a34e01f87b74ff"><div><a href='#SkPaint_containsText'>containsText</a> returns true that <a href='undocumented#Glyph'>glyph</a> index is greater than zero, not
|
||||
<div><fiddle-embed name="6a68cb3c8b81a5976c81ee004f559247"><div><a href='#SkPaint_containsText'>containsText</a> returns true that <a href='undocumented#Glyph'>glyph</a> index is greater than zero, not
|
||||
that it corresponds to an entry in <a href='undocumented#Typeface'>Typeface</a>.
|
||||
</div>
|
||||
|
||||
@ -3960,7 +3872,7 @@ Only supported on platforms that use FreeType as the <a href='SkFont_Reference#
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="c12686b0b3e0a87d0a248bbfc57e9492"><div>Convert UTF-8 <a href='#SkPaint_glyphsToUnichars_text'>text</a> to <a href='#SkPaint_glyphsToUnichars_glyphs'>glyphs</a>; then convert <a href='#SkPaint_glyphsToUnichars_glyphs'>glyphs</a> to Unichar code <a href='SkPoint_Reference#Point'>points</a>.
|
||||
<div><fiddle-embed name="79c550ec6c34054ab60fbcd1b81adc03"><div>Convert UTF-8 <a href='#SkPaint_glyphsToUnichars_text'>text</a> to <a href='#SkPaint_glyphsToUnichars_glyphs'>glyphs</a>; then convert <a href='#SkPaint_glyphsToUnichars_glyphs'>glyphs</a> to Unichar code <a href='SkPoint_Reference#Point'>points</a>.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
<a name='Measure_Text'></a>
|
||||
@ -4378,7 +4290,7 @@ Uses <a href='undocumented#SkTypeface'>SkTypeface</a> to get the <a href='undocu
|
||||
and <a href='#Text_Size'>text size</a>, <a href='#Fake_Bold'>fake bold</a>, and <a href='undocumented#SkPathEffect'>SkPathEffect</a> to scale and modify the <a href='undocumented#Glyph'>glyph</a> <a href='SkPath_Reference#Path'>paths</a>.
|
||||
Uses run array to position <a href='#SkPaint_getTextBlobIntercepts_intervals'>intervals</a>.
|
||||
|
||||
<a href='undocumented#SkTextEncoding'>SkTextEncoding</a> must be set to <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_kGlyphID_TextEncoding'>kGlyphID_TextEncoding</a>.
|
||||
<a href='undocumented#SkTextEncoding'>SkTextEncoding</a> must be set to <a href='undocumented#kGlyphID_SkTextEncoding'>kGlyphID_SkTextEncoding</a>.
|
||||
|
||||
Pass nullptr for <a href='#SkPaint_getTextBlobIntercepts_intervals'>intervals</a> to determine the <a href='undocumented#Size'>size</a> of the interval array.
|
||||
|
||||
|
@ -798,7 +798,7 @@ fonts; may be nullptr
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="640321e8ecfb3f9329f3bc6e1f02485f" gpu="true" cpu="true"><div><a href='SkPaint_Reference#LCD_Text'>LCD text</a> takes advantage of raster striping to improve resolution. Only one of
|
||||
<div><fiddle-embed name="640321e8ecfb3f9329f3bc6e1f02485f" gpu="true" cpu="true"><div>LCD <a href='undocumented#Text'>text</a> takes advantage of raster striping to improve resolution. Only one of
|
||||
the four combinations is correct, depending on whether monitor LCD striping is
|
||||
horizontal or vertical, and whether the order of the stripes is red blue green
|
||||
or red green blue.
|
||||
|
@ -39,9 +39,9 @@ Helper class for constructing <a href='SkTextBlob_Reference#SkTextBlob'>SkTextBl
|
||||
|
||||
<a href='#SkTextBlobBuilder_RunBuffer'>RunBuffer</a> supplies storage for <a href='undocumented#Glyph'>Glyphs</a> and positions within a run.
|
||||
|
||||
A run is a sequence of <a href='undocumented#Glyph'>Glyphs</a> sharing <a href='#Paint_Font_Metrics'>Paint_Font_Metrics</a> and positioning.
|
||||
A run is a sequence of <a href='undocumented#Glyph'>Glyphs</a> sharing <a href='#Font_Metrics'>Font_Metrics</a> and positioning.
|
||||
Each run may position its <a href='undocumented#Glyph'>Glyphs</a> in one of three ways:
|
||||
by specifying where the first <a href='undocumented#Glyph'>Glyph</a> is drawn, and allowing <a href='#Paint_Font_Metrics'>Paint_Font_Metrics</a> to
|
||||
by specifying where the first <a href='undocumented#Glyph'>Glyph</a> is drawn, and allowing <a href='#Font_Metrics'>Font_Metrics</a> to
|
||||
determine the advance to subsequent <a href='undocumented#Glyph'>Glyphs</a>; by specifying a baseline, and
|
||||
the position on that baseline for each <a href='undocumented#Glyph'>Glyph</a> in run; or by providing <a href='SkPoint_Reference#Point'>Point</a>
|
||||
array, one per <a href='undocumented#Glyph'>Glyph</a>.<table style='border-collapse: collapse; width: 62.5em'>
|
||||
@ -183,7 +183,7 @@ Returns run with storage for <a href='undocumented#Glyph'>glyphs</a>. Caller mus
|
||||
|
||||
<a href='undocumented#Glyph'>Glyphs</a> share metrics in <a href='#SkTextBlobBuilder_allocRun_font'>font</a>.
|
||||
|
||||
<a href='undocumented#Glyph'>Glyphs</a> are positioned on a baseline at (<a href='#SkTextBlobBuilder_allocRun_x'>x</a>, <a href='#SkTextBlobBuilder_allocRun_y'>y</a>), using <a href='#SkTextBlobBuilder_allocRun_font'>font</a> metrics to
|
||||
<a href='undocumented#Glyph'>Glyphs</a> are positioned on a baseline at (<a href='#SkTextBlobBuilder_allocRun_x'>x</a>, <a href='#SkTextBlobBuilder_allocRun_y'>y</a>), using <a href='undocumented#Font_Metrics'>font metrics</a> to
|
||||
determine their relative placement.
|
||||
|
||||
<a href='#SkTextBlobBuilder_allocRun_bounds'>bounds</a> defines an optional bounding box, used to suppress drawing when <a href='SkTextBlob_Reference#SkTextBlob'>SkTextBlob</a>
|
||||
|
@ -45,7 +45,7 @@ conservative bounding box
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="a22a490fd43bcc1cd3e26430debfb99e"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="fb8b2502bbe52d2029aecdf569dd9fdb"></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -67,7 +67,7 @@ identifier for <a href='SkTextBlob_Reference#SkTextBlob'>SkTextBlob</a>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="fdd9c8c4470cc4f725af779e9d6db6e4"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="6e12cceca981ddabc0fc18c380543f34"></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -82,13 +82,13 @@ static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkTextBlob_Reference#S
|
||||
<a href='undocumented#SkTextEncoding'>SkTextEncoding</a> encoding = <a href='undocumented#kUTF8_SkTextEncoding'>kUTF8_SkTextEncoding</a>)
|
||||
</pre>
|
||||
|
||||
Creates <a href='#Text_Blob'>Text_Blob</a> with a single run. <a href='#SkTextBlob_MakeFromText_text'>text</a> meaning depends on <a href='#Paint_Text_Encoding'>Paint_Text_Encoding</a>;
|
||||
Creates <a href='#Text_Blob'>Text_Blob</a> with a single run. <a href='#SkTextBlob_MakeFromText_text'>text</a> meaning depends on <a href='#Text_Encoding'>Text_Encoding</a>;
|
||||
by default, <a href='#SkTextBlob_MakeFromText_text'>text</a> is encoded as UTF-8.
|
||||
|
||||
<a href='#SkTextBlob_MakeFromText_font'>font</a> contains attributes used to define the run <a href='#SkTextBlob_MakeFromText_text'>text</a>: <a href='undocumented#Typeface'>Typeface</a>, <a href='#Paint_Text_Size'>Paint_Text_Size</a>, <a href='#Paint_Text_Scale_X'>Paint_Text_Scale_X</a>,
|
||||
<a href='#Paint_Text_Skew_X'>Paint_Text_Skew_X</a>, <a href='#Paint_Hinting'>Paint_Hinting</a>, <a href='#Paint_Anti_Alias'>Anti_Alias</a>, <a href='#Paint_Fake_Bold'>Paint_Fake_Bold</a>,
|
||||
<a href='#Paint_Font_Embedded_Bitmaps'>Font_Embedded_Bitmaps</a>, <a href='#Paint_Full_Hinting_Spacing'>Full_Hinting_Spacing</a>, <a href='#Paint_LCD_Text'>LCD_Text</a>, <a href='#Paint_Linear_Text'>Linear_Text</a>,
|
||||
and <a href='#Paint_Subpixel_Text'>Subpixel_Text</a>
|
||||
<a href='#SkTextBlob_MakeFromText_font'>font</a> contains attributes used to define the run <a href='#SkTextBlob_MakeFromText_text'>text</a>: <a href='undocumented#Typeface'>Typeface</a>, <a href='#Font_Size'>Font_Size</a>, <a href='#Font_Scale_X'>Font_Scale_X</a>,
|
||||
<a href='#Font_Skew_X'>Font_Skew_X</a>, <a href='#Font_Hinting'>Font_Hinting</a>, <a href='#Paint_Anti_Alias'>Paint_Anti_Alias</a>, <a href='#Font_Embolden'>Font_Embolden</a>, <a href='#Font_Force_Hinting'>Font_Force_Hinting</a>,
|
||||
<a href='#Font_Embedded_Bitmaps'>Font_Embedded_Bitmaps</a>, <a href='#Font_Hinting_Spacing'>Font_Hinting_Spacing</a>, <a href='#Font_Anti_Alias'>Font_Anti_Alias</a>, <a href='#Font_Linear'>Font_Linear</a>,
|
||||
and <a href='#Font_Subpixel'>Font_Subpixel</a>
|
||||
.
|
||||
|
||||
### Parameters
|
||||
@ -130,13 +130,13 @@ static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkTextBlob_Reference#S
|
||||
<a href='undocumented#SkTextEncoding'>SkTextEncoding</a> encoding = <a href='undocumented#kUTF8_SkTextEncoding'>kUTF8_SkTextEncoding</a>)
|
||||
</pre>
|
||||
|
||||
Creates <a href='#Text_Blob'>Text_Blob</a> with a single run. <a href='#SkTextBlob_MakeFromString_string'>string</a> meaning depends on <a href='#Paint_Text_Encoding'>Paint_Text_Encoding</a>;
|
||||
Creates <a href='#Text_Blob'>Text_Blob</a> with a single run. <a href='#SkTextBlob_MakeFromString_string'>string</a> meaning depends on <a href='#Text_Encoding'>Text_Encoding</a>;
|
||||
by default, <a href='#SkTextBlob_MakeFromString_string'>string</a> is encoded as UTF-8.
|
||||
|
||||
<a href='#SkTextBlob_MakeFromString_font'>font</a> contains <a href='#Paint_Font_Metrics'>Paint_Font_Metrics</a> used to define the run <a href='undocumented#Text'>text</a>: <a href='undocumented#Typeface'>Typeface</a>, <a href='#Paint_Text_Size'>Paint_Text_Size</a>, <a href='#Paint_Text_Scale_X'>Paint_Text_Scale_X</a>,
|
||||
<a href='#Paint_Text_Skew_X'>Paint_Text_Skew_X</a>, <a href='#Paint_Hinting'>Paint_Hinting</a>, <a href='#Paint_Anti_Alias'>Anti_Alias</a>, <a href='#Paint_Fake_Bold'>Paint_Fake_Bold</a>,
|
||||
<a href='#Paint_Font_Embedded_Bitmaps'>Font_Embedded_Bitmaps</a>, <a href='#Paint_Full_Hinting_Spacing'>Full_Hinting_Spacing</a>, <a href='#Paint_LCD_Text'>LCD_Text</a>, <a href='#Paint_Linear_Text'>Linear_Text</a>,
|
||||
and <a href='#Paint_Subpixel_Text'>Subpixel_Text</a>
|
||||
<a href='#SkTextBlob_MakeFromString_font'>font</a> contains <a href='#Font_Metrics'>Font_Metrics</a> used to define the run <a href='undocumented#Text'>text</a>: <a href='undocumented#Typeface'>Typeface</a>, <a href='#Font_Size'>Font_Size</a>, <a href='#Font_Scale_X'>Font_Scale_X</a>,
|
||||
<a href='#Font_Skew_X'>Font_Skew_X</a>, <a href='#Font_Hinting'>Font_Hinting</a>, <a href='#Paint_Anti_Alias'>Paint_Anti_Alias</a>, <a href='#Font_Embolden'>Font_Embolden</a>, <a href='#Font_Force_Hinting'>Font_Force_Hinting</a>,
|
||||
<a href='#Font_Embedded_Bitmaps'>Font_Embedded_Bitmaps</a>, <a href='#Font_Hinting_Spacing'>Font_Hinting_Spacing</a>, <a href='#Font_Anti_Alias'>Font_Anti_Alias</a>, <a href='#Font_Linear'>Font_Linear</a>,
|
||||
and <a href='#Font_Subpixel'>Font_Subpixel</a>
|
||||
.
|
||||
|
||||
### Parameters
|
||||
|
@ -1401,8 +1401,8 @@
|
||||
"stdout": "[ 1.0000 0.0000 3.0000][ 0.0000 2.0000 4.0000][ 0.0000 0.0000 1.0000]\\n"
|
||||
},
|
||||
"SkPaint_containsText": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n const uint16_t goodGlyph = 511;\n const uint16_t zeroGlyph = 0;\n const uint16_t badGlyph = 65535; // larger than glyph count in font\n paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);\n SkDebugf(\"0x%04x %c= has glyph\\n\", goodGlyph,\n paint.containsText(&goodGlyph, 2) ? '=' : '!');\n SkDebugf(\"0x%04x %c= has glyph\\n\", zeroGlyph,\n paint.containsText(&zeroGlyph, 2) ? '=' : '!');\n SkDebugf(\"0x%04x %c= has glyph\\n\", badGlyph,\n paint.containsText(&badGlyph, 2) ? '=' : '!');\n}",
|
||||
"hash": "083557b6f653d6fc00a34e01f87b74ff",
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n const uint16_t goodGlyph = 511;\n const uint16_t zeroGlyph = 0;\n const uint16_t badGlyph = 65535; // larger than glyph count in font\n paint.setTextEncoding(kGlyphID_SkTextEncoding);\n SkDebugf(\"0x%04x %c= has glyph\\n\", goodGlyph,\n paint.containsText(&goodGlyph, 2) ? '=' : '!');\n SkDebugf(\"0x%04x %c= has glyph\\n\", zeroGlyph,\n paint.containsText(&zeroGlyph, 2) ? '=' : '!');\n SkDebugf(\"0x%04x %c= has glyph\\n\", badGlyph,\n paint.containsText(&badGlyph, 2) ? '=' : '!');\n}",
|
||||
"hash": "6a68cb3c8b81a5976c81ee004f559247",
|
||||
"file": "SkPaint_Reference",
|
||||
"name": "SkPaint::containsText",
|
||||
"stdout": "0x01ff == has glyph\\n0x0000 != has glyph\\n0xffff == has glyph\\n"
|
||||
@ -1576,11 +1576,11 @@
|
||||
"stdout": "SkPaint::kFill_Style == paint.getStyle()\\n"
|
||||
},
|
||||
"SkPaint_getTextEncoding": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n SkDebugf(\"kUTF8_TextEncoding %c= text encoding\\n\",\n SkPaint::kUTF8_TextEncoding == paint.getTextEncoding() ? '=' : '!');\n paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);\n SkDebugf(\"kGlyphID_TextEncoding %c= text encoding\\n\",\n SkPaint::kGlyphID_TextEncoding == paint.getTextEncoding() ? '=' : '!');\n}",
|
||||
"hash": "c6cc2780a9828b3af8c4621c12b29a1b",
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n SkDebugf(\"kUTF8_SkTextEncoding %c= text encoding\\n\",\n kUTF8_SkTextEncoding == paint.getTextEncoding() ? '=' : '!');\n paint.setTextEncoding(kGlyphID_SkTextEncoding);\n SkDebugf(\"kGlyphID_SkTextEncoding %c= text encoding\\n\",\n kGlyphID_SkTextEncoding == paint.getTextEncoding() ? '=' : '!');\n}",
|
||||
"hash": "0d21e968e9a4c78c902ae3ef494941a0",
|
||||
"file": "SkPaint_Reference",
|
||||
"name": "SkPaint::getTextEncoding",
|
||||
"stdout": "kUTF8_TextEncoding == text encoding\\nkGlyphID_TextEncoding == text encoding\\n"
|
||||
"stdout": "kUTF8_SkTextEncoding == text encoding\\nkGlyphID_SkTextEncoding == text encoding\\n"
|
||||
},
|
||||
"SkPaint_getTextScaleX": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n SkDebugf(\"1 %c= default text scale x\\n\", 1 == paint.getTextScaleX() ? '=' : '!');\n}",
|
||||
@ -1884,8 +1884,8 @@
|
||||
"stdout": "paint1 == paint2\\n"
|
||||
},
|
||||
"SkPaint_setTextEncoding": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setTextEncoding((SkPaint::TextEncoding) 4);\n SkDebugf(\"4 %c= text encoding\\n\", (SkPaint::TextEncoding) 4 == paint.getTextEncoding() ? '=' : '!');\n}",
|
||||
"hash": "6d9ffdd3c5543e9f12972a06dd4a0ce5",
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setTextEncoding((SkTextEncoding) 4);\n SkDebugf(\"4 %c= text encoding\\n\", (SkTextEncoding) 4 == paint.getTextEncoding() ? '=' : '!');\n}",
|
||||
"hash": "a5d1ba0dbf42afb797ffdb07647b5cb9",
|
||||
"file": "SkPaint_Reference",
|
||||
"name": "SkPaint::setTextEncoding",
|
||||
"stdout": "4 != text encoding\\n"
|
||||
@ -4245,10 +4245,10 @@
|
||||
"name": "Stroke_Width"
|
||||
},
|
||||
"Paint_Text_Encoding": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n const char hello8[] = \"Hello\" \"\\xE2\" \"\\x98\" \"\\xBA\";\n const uint16_t hello16[] = { 'H', 'e', 'l', 'l', 'o', 0x263A };\n const uint32_t hello32[] = { 'H', 'e', 'l', 'l', 'o', 0x263A };\n paint.setTextSize(24);\n canvas->drawText(hello8, sizeof(hello8) - 1, 10, 30, paint);\n paint.setTextEncoding(SkPaint::kUTF16_TextEncoding);\n canvas->drawText(hello16, sizeof(hello16), 10, 60, paint);\n paint.setTextEncoding(SkPaint::kUTF32_TextEncoding);\n canvas->drawText(hello32, sizeof(hello32), 10, 90, paint);\n uint16_t glyphs[SK_ARRAY_COUNT(hello32)];\n paint.textToGlyphs(hello32, sizeof(hello32), glyphs);\n paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);\n canvas->drawText(glyphs, sizeof(glyphs), 10, 120, paint);\n}\n",
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n const char hello8[] = \"Hello\" \"\\xE2\" \"\\x98\" \"\\xBA\";\n const uint16_t hello16[] = { 'H', 'e', 'l', 'l', 'o', 0x263A };\n const uint32_t hello32[] = { 'H', 'e', 'l', 'l', 'o', 0x263A };\n paint.setTextSize(24);\n canvas->drawText(hello8, sizeof(hello8) - 1, 10, 30, paint);\n paint.setTextEncoding(kUTF16_SkTextEncoding);\n canvas->drawText(hello16, sizeof(hello16), 10, 60, paint);\n paint.setTextEncoding(kUTF32_SkTextEncoding);\n canvas->drawText(hello32, sizeof(hello32), 10, 90, paint);\n uint16_t glyphs[SK_ARRAY_COUNT(hello32)];\n paint.textToGlyphs(hello32, sizeof(hello32), glyphs);\n paint.setTextEncoding(kGlyphID_SkTextEncoding);\n canvas->drawText(glyphs, sizeof(glyphs), 10, 120, paint);\n}\n",
|
||||
"width": 256,
|
||||
"height": 128,
|
||||
"hash": "b29294e7f29d160a1b46abf2dcec9d2a",
|
||||
"hash": "767fa4e7b6300e16a419f9881f0f9d3d",
|
||||
"file": "SkPaint_Reference",
|
||||
"name": "Text_Encoding"
|
||||
},
|
||||
@ -5237,10 +5237,10 @@
|
||||
"name": "SkCanvas::drawText"
|
||||
},
|
||||
"SkCanvas_drawTextBlob": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkTextBlobBuilder textBlobBuilder;\n const char bunny[] = \"/(^x^)\\\\\";\n const int len = sizeof(bunny) - 1;\n uint16_t glyphs[len];\n SkPaint paint;\n paint.textToGlyphs(bunny, len, glyphs);\n paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);\n SkFont font;\n int runs[] = { 3, 1, 3 };\n SkPoint textPos = { 20, 100 };\n int glyphIndex = 0;\n for (auto runLen : runs) {\n font.setSize(1 == runLen ? 20 : 50);\n const SkTextBlobBuilder::RunBuffer& run =\n textBlobBuilder.allocRun(font, runLen, textPos.fX, textPos.fY);\n memcpy(run.glyphs, &glyphs[glyphIndex], sizeof(glyphs[0]) * runLen);\n paint.setTextSize(1 == runLen ? 20 : 50);\n textPos.fX += paint.measureText(&glyphs[glyphIndex], sizeof(glyphs[0]) * runLen, nullptr);\n glyphIndex += runLen;\n }\n sk_sp<const SkTextBlob> blob = textBlobBuilder.make();\n paint.reset();\n canvas->drawTextBlob(blob.get(), 0, 0, paint);\n}\n",
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkTextBlobBuilder textBlobBuilder;\n const char bunny[] = \"/(^x^)\\\\\";\n const int len = sizeof(bunny) - 1;\n uint16_t glyphs[len];\n SkPaint paint;\n paint.textToGlyphs(bunny, len, glyphs);\n paint.setTextEncoding(kGlyphID_SkTextEncoding);\n SkFont font;\n int runs[] = { 3, 1, 3 };\n SkPoint textPos = { 20, 100 };\n int glyphIndex = 0;\n for (auto runLen : runs) {\n font.setSize(1 == runLen ? 20 : 50);\n const SkTextBlobBuilder::RunBuffer& run =\n textBlobBuilder.allocRun(font, runLen, textPos.fX, textPos.fY);\n memcpy(run.glyphs, &glyphs[glyphIndex], sizeof(glyphs[0]) * runLen);\n paint.setTextSize(1 == runLen ? 20 : 50);\n textPos.fX += paint.measureText(&glyphs[glyphIndex], sizeof(glyphs[0]) * runLen, nullptr);\n glyphIndex += runLen;\n }\n sk_sp<const SkTextBlob> blob = textBlobBuilder.make();\n paint.reset();\n canvas->drawTextBlob(blob.get(), 0, 0, paint);\n}\n",
|
||||
"width": 256,
|
||||
"height": 120,
|
||||
"hash": "a207bbd7317bfbdadbda8af884631e46",
|
||||
"hash": "005502b502c1282cb8d306d6c8d998fb",
|
||||
"file": "SkCanvas_Reference",
|
||||
"name": "SkCanvas::drawTextBlob"
|
||||
},
|
||||
@ -7445,10 +7445,10 @@
|
||||
"name": "SkPaint::getTextWidths"
|
||||
},
|
||||
"SkPaint_glyphsToUnichars": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n const char hello[] = \"Hello!\";\n const int count = sizeof(hello) - 1;\n SkGlyphID glyphs[count];\n if (count != paint.textToGlyphs(hello, count, glyphs)) {\n return;\n }\n SkUnichar unichars[count];\n paint.glyphsToUnichars(glyphs, count, unichars);\n paint.setTextEncoding(SkPaint::kUTF32_TextEncoding);\n canvas->drawText(unichars, sizeof(unichars), 10, 30, paint);\n}\n",
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n const char hello[] = \"Hello!\";\n const int count = sizeof(hello) - 1;\n SkGlyphID glyphs[count];\n if (count != paint.textToGlyphs(hello, count, glyphs)) {\n return;\n }\n SkUnichar unichars[count];\n paint.glyphsToUnichars(glyphs, count, unichars);\n paint.setTextEncoding(kUTF32_SkTextEncoding);\n canvas->drawText(unichars, sizeof(unichars), 10, 30, paint);\n}\n",
|
||||
"width": 256,
|
||||
"height": 64,
|
||||
"hash": "c12686b0b3e0a87d0a248bbfc57e9492",
|
||||
"hash": "79c550ec6c34054ab60fbcd1b81adc03",
|
||||
"file": "SkPaint_Reference",
|
||||
"name": "SkPaint::glyphsToUnichars"
|
||||
},
|
||||
@ -7549,10 +7549,10 @@
|
||||
"name": "SkPaint::setTypeface"
|
||||
},
|
||||
"SkPaint_textToGlyphs": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n const uint8_t utf8[] = { 0x24, 0xC2, 0xA2, 0xE2, 0x82, 0xAC, 0xC2, 0xA5, 0xC2, 0xA3 };\n std::vector<SkGlyphID> glyphs;\n int count = paint.textToGlyphs(utf8, sizeof(utf8), nullptr);\n glyphs.resize(count);\n (void) paint.textToGlyphs(utf8, sizeof(utf8), &glyphs.front());\n paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);\n paint.setTextSize(32);\n canvas->drawText(&glyphs.front(), glyphs.size() * sizeof(SkGlyphID), 10, 40, paint);\n}\n",
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n const uint8_t utf8[] = { 0x24, 0xC2, 0xA2, 0xE2, 0x82, 0xAC, 0xC2, 0xA5, 0xC2, 0xA3 };\n std::vector<SkGlyphID> glyphs;\n int count = paint.textToGlyphs(utf8, sizeof(utf8), nullptr);\n glyphs.resize(count);\n (void) paint.textToGlyphs(utf8, sizeof(utf8), &glyphs.front());\n paint.setTextEncoding(kGlyphID_SkTextEncoding);\n paint.setTextSize(32);\n canvas->drawText(&glyphs.front(), glyphs.size() * sizeof(SkGlyphID), 10, 40, paint);\n}\n",
|
||||
"width": 256,
|
||||
"height": 64,
|
||||
"hash": "343e9471a7f7b5f09abdc3b44983433b",
|
||||
"hash": "d11136d8a74f63009da2a7f550710823",
|
||||
"file": "SkPaint_Reference",
|
||||
"name": "SkPaint::textToGlyphs"
|
||||
},
|
||||
@ -9341,10 +9341,10 @@
|
||||
"name": "SkTextBlob::MakeFromText"
|
||||
},
|
||||
"SkTextBlob_bounds": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkTextBlobBuilder textBlobBuilder;\n const char bunny[] = \"/(^x^)\\\\\";\n const int len = sizeof(bunny) - 1;\n uint16_t glyphs[len];\n SkPaint paint;\n paint.textToGlyphs(bunny, len, glyphs);\n paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);\n SkFont font;\n int runs[] = { 3, 1, 3 };\n SkPoint textPos = { 20, 50 };\n int glyphIndex = 0;\n for (auto runLen : runs) {\n font.setSize(1 == runLen ? 20 : 50);\n paint.setTextSize(1 == runLen ? 20 : 50);\n const SkTextBlobBuilder::RunBuffer& run =\n textBlobBuilder.allocRun(font, runLen, textPos.fX, textPos.fY);\n memcpy(run.glyphs, &glyphs[glyphIndex], sizeof(glyphs[0]) * runLen);\n textPos.fX += paint.measureText(&glyphs[glyphIndex], sizeof(glyphs[0]) * runLen, nullptr);\n glyphIndex += runLen;\n }\n sk_sp<const SkTextBlob> blob = textBlobBuilder.make();\n canvas->drawTextBlob(blob.get(), 0, 0, paint);\n paint.setStyle(SkPaint::kStroke_Style);\n canvas->drawRect(blob->bounds(), paint);\n}",
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkTextBlobBuilder textBlobBuilder;\n const char bunny[] = \"/(^x^)\\\\\";\n const int len = sizeof(bunny) - 1;\n uint16_t glyphs[len];\n SkPaint paint;\n paint.textToGlyphs(bunny, len, glyphs);\n paint.setTextEncoding(kGlyphID_SkTextEncoding);\n SkFont font;\n int runs[] = { 3, 1, 3 };\n SkPoint textPos = { 20, 50 };\n int glyphIndex = 0;\n for (auto runLen : runs) {\n font.setSize(1 == runLen ? 20 : 50);\n paint.setTextSize(1 == runLen ? 20 : 50);\n const SkTextBlobBuilder::RunBuffer& run =\n textBlobBuilder.allocRun(font, runLen, textPos.fX, textPos.fY);\n memcpy(run.glyphs, &glyphs[glyphIndex], sizeof(glyphs[0]) * runLen);\n textPos.fX += paint.measureText(&glyphs[glyphIndex], sizeof(glyphs[0]) * runLen, nullptr);\n glyphIndex += runLen;\n }\n sk_sp<const SkTextBlob> blob = textBlobBuilder.make();\n canvas->drawTextBlob(blob.get(), 0, 0, paint);\n paint.setStyle(SkPaint::kStroke_Style);\n canvas->drawRect(blob->bounds(), paint);\n}",
|
||||
"width": 256,
|
||||
"height": 70,
|
||||
"hash": "a22a490fd43bcc1cd3e26430debfb99e",
|
||||
"hash": "fb8b2502bbe52d2029aecdf569dd9fdb",
|
||||
"file": "SkTextBlob_Reference",
|
||||
"name": "SkTextBlob::bounds()"
|
||||
},
|
||||
@ -9365,10 +9365,10 @@
|
||||
"name": "SkTextBlob::serialize_2"
|
||||
},
|
||||
"SkTextBlob_uniqueID": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n for (int index = 0; index < 2; ++index) {\n SkTextBlobBuilder textBlobBuilder;\n const char bunny[] = \"/(^x^)\\\\\";\n const int len = sizeof(bunny) - 1;\n uint16_t glyphs[len];\n SkPaint paint;\n paint.textToGlyphs(bunny, len, glyphs);\n paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);\n paint.setTextScaleX(0.5);\n SkFont font;\n font.setScaleX(0.5);\n int runs[] = { 3, 1, 3 };\n SkPoint textPos = { 20, 50 };\n int glyphIndex = 0;\n for (auto runLen : runs) {\n font.setSize(1 == runLen ? 20 : 50);\n paint.setTextSize(1 == runLen ? 20 : 50);\n const SkTextBlobBuilder::RunBuffer& run =\n textBlobBuilder.allocRun(font, runLen, textPos.fX, textPos.fY);\n memcpy(run.glyphs, &glyphs[glyphIndex], sizeof(glyphs[0]) * runLen);\n textPos.fX += paint.measureText(&glyphs[glyphIndex], sizeof(glyphs[0]) * runLen, nullptr);\n glyphIndex += runLen;\n }\n sk_sp<const SkTextBlob> blob = textBlobBuilder.make();\n paint.reset();\n canvas->drawTextBlob(blob.get(), 0, 0, paint);\n std::string id = \"unique ID:\" + std::to_string(blob->uniqueID());\n canvas->drawString(id.c_str(), 30, blob->bounds().fBottom + 15, paint);\n canvas->translate(blob->bounds().fRight + 10, 0);\n }\n}",
|
||||
"code": "void draw(SkCanvas* canvas) {\n for (int index = 0; index < 2; ++index) {\n SkTextBlobBuilder textBlobBuilder;\n const char bunny[] = \"/(^x^)\\\\\";\n const int len = sizeof(bunny) - 1;\n uint16_t glyphs[len];\n SkPaint paint;\n paint.textToGlyphs(bunny, len, glyphs);\n paint.setTextEncoding(kGlyphID_SkTextEncoding);\n paint.setTextScaleX(0.5);\n SkFont font;\n font.setScaleX(0.5);\n int runs[] = { 3, 1, 3 };\n SkPoint textPos = { 20, 50 };\n int glyphIndex = 0;\n for (auto runLen : runs) {\n font.setSize(1 == runLen ? 20 : 50);\n paint.setTextSize(1 == runLen ? 20 : 50);\n const SkTextBlobBuilder::RunBuffer& run =\n textBlobBuilder.allocRun(font, runLen, textPos.fX, textPos.fY);\n memcpy(run.glyphs, &glyphs[glyphIndex], sizeof(glyphs[0]) * runLen);\n textPos.fX += paint.measureText(&glyphs[glyphIndex], sizeof(glyphs[0]) * runLen, nullptr);\n glyphIndex += runLen;\n }\n sk_sp<const SkTextBlob> blob = textBlobBuilder.make();\n paint.reset();\n canvas->drawTextBlob(blob.get(), 0, 0, paint);\n std::string id = \"unique ID:\" + std::to_string(blob->uniqueID());\n canvas->drawString(id.c_str(), 30, blob->bounds().fBottom + 15, paint);\n canvas->translate(blob->bounds().fRight + 10, 0);\n }\n}",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"hash": "fdd9c8c4470cc4f725af779e9d6db6e4",
|
||||
"hash": "6e12cceca981ddabc0fc18c380543f34",
|
||||
"file": "SkTextBlob_Reference",
|
||||
"name": "SkTextBlob::uniqueID"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user