51 for (
int i = 0;
i <
count - 1; ++
i) {
52 globalAdj += adjustments[
i] *
scale;
53 pos[
i + 1].
fX += globalAdj;
73 int32_t* adjustments = adjustmentStorage.
get();
116 name.append(
"_kerning");
128 const char*
text = fApplyKerning ?
"Type AWAY" :
"Hamburgefons";
129 const size_t textLen = strlen(
text);
137 font.setSubpixel(
true);
139 font.setLinearMetrics(
true);
145 font.setTypeface(fFaces[
i]);
167 }
constexpr aliasTypes[] {
168#ifndef SK_BUILD_FOR_IOS
196 constexpr SkScalar textSizes[] = { 9, 10, 11, 12, 13, 14, 15, 16 };
205 struct SubpixelType {
208 }
constexpr subpixelTypes[] = {
209 {
false, { 0.00, 0.00 } },
210 {
true , { 0.00, 0.00 } },
211 {
true , { 0.25, 0.00 } },
212 {
true , { 0.25, 0.25 } },
215 constexpr bool rotateABitTypes[] = {
false,
true };
222 font.setEmbeddedBitmaps(
true);
227 for (
const SubpixelType subpixel : subpixelTypes) {
229 font.setSubpixel(subpixel.requested);
231 for (
const AliasType& alias : aliasTypes) {
232 font.setEdging(alias.edging);
238 for (
const SkScalar& textSize : textSizes) {
240 font.setSize(textSize);
245 font.setHinting(hinting);
247 for (
const bool& rotateABit : rotateABitTypes) {
250 canvas->
rotate(2,
x + subpixel.offset.x(),
251 y + subpixel.offset.y());
254 x + subpixel.offset.x(),
270 constexpr struct StyleTests {
280 constexpr bool fakeBoldTypes[] = {
false,
true };
288 for (
const bool& fakeBold : fakeBoldTypes) {
293 font.setEmbolden(fakeBold);
294 for (
const AliasType& alias : aliasTypes) {
295 font.setEdging(alias.edging);
300 for (
const StyleTests& style : styleTypes) {
301 paint.setStyle(style.style);
302 paint.setStrokeWidth(style.strokeWidth);
315 constexpr struct MaskTests {
342 for (
const AliasType& alias : aliasTypes) {
347 font.setEdging(alias.edging);
352 for (
const MaskTests& mask : maskTypes) {
361 paint.setMaskFilter(
nullptr);
381#ifndef SK_BUILD_FOR_WIN
414 uint16_t
glyphs[1] = {
font.unicharToGlyph(
'A') };
424 paint.setStyle(style);
427 font.setEmbolden(
true);
431 font.setEmbolden(
false);
449 for (
auto r : recs) {
450 draw(r.style, r.width);
static const int strokeWidth
@ kOuter_SkBlurStyle
nothing inside, fuzzy outside
@ kSolid_SkBlurStyle
solid inside, fuzzy outside
@ kInner_SkBlurStyle
fuzzy inside, nothing outside
@ kNormal_SkBlurStyle
fuzzy inside and outside
constexpr SkColor SK_ColorYELLOW
@ kNormal
glyph outlines modified to improve constrast
@ kNone
glyph outlines unchanged
@ kSlight
minimal modification to improve constrast
@ kFull
modifies glyph outlines for maximum constrast
@ kUTF8
uses bytes to represent UTF-8 or ASCII
@ kGlyphID
uses two byte words to represent glyph indices
#define SkScalarCeilToScalar(x)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
int saveLayer(const SkRect *bounds, const SkPaint *paint)
void drawSimpleText(const void *text, size_t byteLength, SkTextEncoding encoding, SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
void drawGlyphs(int count, const SkGlyphID glyphs[], const SkPoint positions[], const uint32_t clusters[], int textByteCount, const char utf8text[], SkPoint origin, const SkFont &font, const SkPaint &paint)
void rotate(SkScalar degrees)
void drawTextBlob(const SkTextBlob *blob, SkScalar x, SkScalar y, const SkPaint &paint)
static constexpr SkFontStyle Italic()
static constexpr SkFontStyle BoldItalic()
static constexpr SkFontStyle Bold()
static constexpr SkFontStyle Normal()
@ kAntiAlias
may have transparent pixels on glyph edges
@ kAlias
no transparent pixels on glyph edges
@ kSubpixelAntiAlias
glyph positioned in pixel using transparency
static sk_sp< SkMaskFilter > MakeBlur(SkBlurStyle style, SkScalar sigma, bool respectCTM=true)
@ kStroke_Style
set to stroke geometry
@ kFill_Style
set to fill geometry
@ kStrokeAndFill_Style
sets to stroke and fill geometry
bool getKerningPairAdjustments(const SkGlyphID glyphs[], int count, int32_t adjustments[]) const
SkGlyphID unicharToGlyph(SkUnichar unichar) const
void onOnceBeforeDraw() override
SkISize getISize() override
void onDraw(SkCanvas *canvas) override
SkString getName() const override
TypefaceStylesGM(bool applyKerning)
static float max(float r, float g, float b)
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
DEF_SWITCHES_START aot vmservice shared library name
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
font
Font Metadata and Metrics.
static constexpr SkISize Make(int32_t w, int32_t h)
void set(float x, float y)
DEF_SIMPLE_GM(typeface_styling, canvas, 710, 360)
static void draw_typeface_rendering_gm(SkCanvas *canvas, sk_sp< SkTypeface > face, SkGlyphID glyph)
DEF_SIMPLE_GM_CAN_FAIL(typefacerendering, canvas, errMsg, 640, 840)
static void applyKerning(SkPoint pos[], const int32_t adjustments[], int count, const SkFont &font)
static void getGlyphPositions(const SkFont &font, const uint16_t glyphs[], int count, SkScalar x, SkScalar y, SkPoint pos[])
constexpr int gStylesCount
static void drawKernText(SkCanvas *canvas, const void *text, size_t len, SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
static constexpr SkFontStyle gStyles[]