42 const auto* ch_ptr = jch->
begin();
43 const auto ch_len = jch->
size();
50 if (!SkTFitsIn<SkGlyphID>(uni)) {
55 const auto glyph_id = SkTo<SkGlyphID>(uni);
58 static constexpr float kPtScale = 0.01f;
59 const auto advance =
ParseDefault(jchar[
"w"], 0.0f) * kPtScale;
63 if (
auto comp_node = ParseGlyphComp(abuilder, *jdata, &glyph_size)) {
75 fGlyphComps.
set(glyph_id, std::move(comp_node));
82 if (!ParseGlyphPath(abuilder, *jdata, &
path)) {
138 auto path_node = abuilder->
attachPath((*jshape)[
"ks"]);
139 auto animators = ascope.release();
141 if (!path_node || !animators.empty()) {
145 path->addPath(path_node->getPath());
153CustomFont::Builder::ParseGlyphComp(
const AnimationBuilder* abuilder,
167 AnimationBuilder::LayerInfo linfo{
169 ParseDefault<float>(jdata[
"ip"], 0.0f),
170 ParseDefault<float>(jdata[
"op"], 0.0f)
173 if (!linfo.fInPoint && !linfo.fOutPoint) {
180 auto comp_node = abuilder->attachPrecompLayer(jdata, &linfo);
183 static constexpr float kPtScale = 0.01f;
186 *glyph_size = {linfo.fSize.
fWidth * kPtScale, linfo.fSize.fHeight * kPtScale};
193 glyph_transform = abuilder->attachMatrix2D(*jtransform, std::move(glyph_transform));
197 std::move(glyph_transform));
201 return std::unique_ptr<CustomFont>(
new CustomFont(std::move(fGlyphComps),
202 fCustomBuilder.detach()));
206 : fGlyphComps(
std::move(glyph_comps))
207 , fTypeface(
std::move(tf))
214 for (
const auto&
font : fFonts) {
215 if (
font->typeface().get() == tf) {
216 auto* comp_node =
font->fGlyphComps.find(gid);
217 return comp_node ? *comp_node :
nullptr;
void setGlyph(SkGlyphID, float advance, const SkPath &)
static SkMatrix Scale(SkScalar sx, SkScalar sy)
static SkPath Rect(const SkRect &, SkPathDirection=SkPathDirection::kCW, unsigned startIndex=0)
const char * begin() const
sk_sp< sksg::Path > attachPath(const skjson::Value &) const
bool parseGlyph(const AnimationBuilder *, const skjson::ObjectValue &)
std::unique_ptr< CustomFont > detach()
sk_sp< sksg::RenderNode > getGlyphComp(const SkTypeface *, SkGlyphID) const
static sk_sp< Matrix > Make(const T &m)
SK_SPI SkUnichar NextUTF8(const char **ptr, const char *end)
SK_SPI int CountUTF8(const char *utf8, size_t byteLength)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
font
Font Metadata and Metrics.
T ParseDefault(const skjson::Value &v, const T &defaultValue)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)