Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkFontHost_FreeType_common.h
Go to the documentation of this file.
1/*
2 * Copyright 2006-2012 The Android Open Source Project
3 * Copyright 2012 Mozilla Foundation
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9#ifndef SKFONTHOST_FREETYPE_COMMON_H_
10#define SKFONTHOST_FREETYPE_COMMON_H_
11
13#include "include/core/SkSpan.h"
15#include "src/core/SkGlyph.h"
17
18class SkCanvas;
19
20// These are forward declared to avoid pimpl but also hide the FreeType implementation.
21typedef struct FT_FaceRec_* FT_Face;
22typedef signed long FT_Pos;
23
24
25#ifdef SK_DEBUG
26const char* SkTraceFtrGetError(int);
27#define SK_TRACEFTR(ERR, MSG, ...) \
28 SkDebugf("%s:%d:1: error: 0x%x '%s' " MSG "\n", __FILE__, __LINE__, (uint32_t)ERR, \
29 SkTraceFtrGetError((int)(ERR)), __VA_ARGS__)
30#else
31#define SK_TRACEFTR(ERR, ...) do { sk_ignore_unused_variable(ERR); } while (false)
32#endif
33
37
38 using LoadGlyphFlags = uint32_t;
39
40 void init(SkColor fgColor, SkScalerContext::Flags);
41
45
49
51 SkSpan<SkColor> palette, SkCanvas*) const;
53 SkSpan<SkColor> palette, SkCanvas*) const;
55 SkSpan<SkColor> palette, SkCanvas*) const;
56 void generateGlyphImage(FT_Face, const SkGlyph&, void*, const SkMatrix& bitmapTransform,
57 const SkMaskGamma::PreBlend&) const;
58 bool generateGlyphPath(FT_Face, SkPath*) const;
59
60 /** Computes a bounding box for a COLRv1 glyph.
61 *
62 * This method may change the configured size and transforms on FT_Face. Make sure to
63 * configure size, matrix and load glyphs as needed after using this function to restore the
64 * state of FT_Face.
65 */
67
68private:
69 bool generateFacePath(FT_Face, SkGlyphID, LoadGlyphFlags, SkPath*) const;
70};
71
72#endif // SKFONTHOST_FREETYPE_COMMON_H_
uint32_t SkColor
Definition SkColor.h:37
signed long FT_Pos
struct FT_FaceRec_ * FT_Face
static constexpr bool SkToBool(const T &x)
Definition SkTo.h:35
uint16_t SkGlyphID
Definition SkTypes.h:179
bool drawCOLRv1Glyph(FT_Face, const SkGlyph &, LoadGlyphFlags, SkSpan< SkColor > palette, SkCanvas *) const
bool drawSVGGlyph(FT_Face, const SkGlyph &, LoadGlyphFlags, SkSpan< SkColor > palette, SkCanvas *) const
static bool computeColrV1GlyphBoundingBox(FT_Face, SkGlyphID, SkRect *bounds)
void generateGlyphImage(FT_Face, const SkGlyph &, void *, const SkMatrix &bitmapTransform, const SkMaskGamma::PreBlend &) const
bool generateGlyphPath(FT_Face, SkPath *) const
void init(SkColor fgColor, SkScalerContext::Flags)
bool drawCOLRv0Glyph(FT_Face, const SkGlyph &, LoadGlyphFlags, SkSpan< SkColor > palette, SkCanvas *) const