• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2024 Google LLC
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #include "src/core/SkAdvancedTypefaceMetrics.h"
9 #include "src/ports/SkTypeface_proxy.h"
10 
11 #include <memory>
12 #include <utility>
13 
onGetUPEM() const14 int SkTypeface_proxy::onGetUPEM() const { return fProxy->getUnitsPerEm(); }
15 
onOpenStream(int * ttcIndex) const16 std::unique_ptr<SkStreamAsset> SkTypeface_proxy::onOpenStream(int* ttcIndex) const {
17     return fProxy->onOpenStream(ttcIndex);
18 }
19 
onMakeClone(const SkFontArguments & args) const20 sk_sp<SkTypeface> SkTypeface_proxy::onMakeClone(const SkFontArguments& args) const {
21     return fProxy->onMakeClone(args);
22 }
23 
onGlyphMaskNeedsCurrentColor() const24 bool SkTypeface_proxy::onGlyphMaskNeedsCurrentColor() const {
25     return fProxy->glyphMaskNeedsCurrentColor();
26 }
27 
onGetVariationDesignPosition(SkFontArguments::VariationPosition::Coordinate coordinates[],int coordinateCount) const28 int SkTypeface_proxy::onGetVariationDesignPosition(
29         SkFontArguments::VariationPosition::Coordinate coordinates[], int coordinateCount) const {
30     return fProxy->onGetVariationDesignPosition(coordinates, coordinateCount);
31 }
32 
onGetVariationDesignParameters(SkFontParameters::Variation::Axis parameters[],int parameterCount) const33 int SkTypeface_proxy::onGetVariationDesignParameters(SkFontParameters::Variation::Axis parameters[],
34                                                      int parameterCount) const {
35     return fProxy->onGetVariationDesignParameters(parameters, parameterCount);
36 }
37 
onGetFontStyle() const38 SkFontStyle SkTypeface_proxy::onGetFontStyle() const {
39     return fProxy->onGetFontStyle();
40 }
41 
onGetFixedPitch() const42 bool SkTypeface_proxy::onGetFixedPitch() const {
43     return fProxy->onGetFixedPitch();
44 }
45 
onGetFamilyName(SkString * familyName) const46 void SkTypeface_proxy::onGetFamilyName(SkString* familyName) const {
47     fProxy->onGetFamilyName(familyName);
48 }
49 
onGetPostScriptName(SkString * postScriptName) const50 bool SkTypeface_proxy::onGetPostScriptName(SkString* postScriptName) const {
51     return fProxy->getPostScriptName(postScriptName);
52 }
53 
onGetResourceName(SkString * resourceName) const54 int SkTypeface_proxy::onGetResourceName(SkString* resourceName) const {
55     return fProxy->getResourceName(resourceName);
56 }
57 
onCreateFamilyNameIterator() const58 SkTypeface::LocalizedStrings* SkTypeface_proxy::onCreateFamilyNameIterator() const {
59     return fProxy->createFamilyNameIterator();
60 }
61 
onGetTableTags(SkFontTableTag tags[]) const62 int SkTypeface_proxy::onGetTableTags(SkFontTableTag tags[]) const {
63     return fProxy->getTableTags(tags);
64 }
65 
onGetTableData(SkFontTableTag tag,size_t offset,size_t length,void * data) const66 size_t SkTypeface_proxy::onGetTableData(SkFontTableTag tag, size_t offset, size_t length, void* data) const {
67     return fProxy->getTableData(tag, offset, length, data);
68 }
69 
onCreateScalerContext(const SkScalerContextEffects & effects,const SkDescriptor * desc) const70 std::unique_ptr<SkScalerContext> SkTypeface_proxy::onCreateScalerContext(
71         const SkScalerContextEffects& effects, const SkDescriptor* desc) const {
72     auto proxyScaler = fProxy->onCreateScalerContextAsProxyTypeface(effects, desc, sk_ref_sp(this));
73     auto scaler = std::make_unique<SkScalerContext_proxy>(
74             std::move(proxyScaler),
75             sk_ref_sp(const_cast<SkTypeface_proxy*>(this)),
76             effects,
77             desc);
78     return scaler;
79 }
80 
onFilterRec(SkScalerContextRec * rec) const81 void SkTypeface_proxy::onFilterRec(SkScalerContextRec* rec) const {
82     fProxy->onFilterRec(rec);
83 }
84 
onGetFontDescriptor(SkFontDescriptor * desc,bool * serialize) const85 void SkTypeface_proxy::onGetFontDescriptor(SkFontDescriptor* desc, bool* serialize) const {
86     fProxy->onGetFontDescriptor(desc, serialize);
87 }
88 
getGlyphToUnicodeMap(SkUnichar * glyphToUnicode) const89 void SkTypeface_proxy::getGlyphToUnicodeMap(SkUnichar* glyphToUnicode) const {
90     fProxy->getGlyphToUnicodeMap(glyphToUnicode);
91 }
92 
getPostScriptGlyphNames(SkString * names) const93 void SkTypeface_proxy::getPostScriptGlyphNames(SkString* names) const {
94     return fProxy->getPostScriptGlyphNames(names);
95 }
96 
onGetAdvancedMetrics() const97 std::unique_ptr<SkAdvancedTypefaceMetrics> SkTypeface_proxy::onGetAdvancedMetrics() const {
98     return fProxy->onGetAdvancedMetrics();
99 }
100 
onCharsToGlyphs(const SkUnichar * chars,int count,SkGlyphID glyphs[]) const101 void SkTypeface_proxy::onCharsToGlyphs(const SkUnichar* chars, int count, SkGlyphID glyphs[]) const {
102     fProxy->unicharsToGlyphs(chars, count, glyphs);
103 }
104 
onCountGlyphs() const105 int SkTypeface_proxy::onCountGlyphs() const { return fProxy->countGlyphs(); }
106 
onGetCTFontRef() const107 void* SkTypeface_proxy::onGetCTFontRef() const { return fProxy->onGetCTFontRef(); }
108 
onGetKerningPairAdjustments(const uint16_t glyphs[],int count,int32_t adjustments[]) const109 bool SkTypeface_proxy::onGetKerningPairAdjustments(const uint16_t glyphs[], int count,
110                                                    int32_t adjustments[]) const  {
111     return fProxy->onGetKerningPairAdjustments(glyphs, count, adjustments);
112 }
113 
SkScalerContext_proxy(std::unique_ptr<SkScalerContext> proxy,sk_sp<SkTypeface_proxy> typeface,const SkScalerContextEffects & effects,const SkDescriptor * desc)114 SkScalerContext_proxy::SkScalerContext_proxy(std::unique_ptr<SkScalerContext> proxy,
115                            sk_sp<SkTypeface_proxy> typeface,
116                            const SkScalerContextEffects& effects,
117                            const SkDescriptor* desc)
118         : SkScalerContext(std::move(typeface), effects, desc)
119         , fProxy(std::move(proxy))
120 { }
121 
generateMetrics(const SkGlyph & glyph,SkArenaAlloc * alloc)122 SkScalerContext::GlyphMetrics SkScalerContext_proxy::generateMetrics(const SkGlyph& glyph, SkArenaAlloc* alloc) {
123     return fProxy->generateMetrics(glyph, alloc);
124 }
125 
generateImage(const SkGlyph & glyph,void * imageBuffer)126 void SkScalerContext_proxy::generateImage(const SkGlyph& glyph, void* imageBuffer) {
127     fProxy->generateImage(glyph, imageBuffer);
128 }
129 
generatePath(const SkGlyph & glyph,SkPath * path,bool * modified)130 bool SkScalerContext_proxy::generatePath(const SkGlyph& glyph, SkPath* path, bool* modified) {
131     return fProxy->generatePath(glyph, path, modified);
132 }
133 
generateDrawable(const SkGlyph & glyph)134 sk_sp<SkDrawable> SkScalerContext_proxy::generateDrawable(const SkGlyph& glyph) {
135     return fProxy->generateDrawable(glyph);
136 }
137 
generateFontMetrics(SkFontMetrics * metrics)138 void SkScalerContext_proxy::generateFontMetrics(SkFontMetrics* metrics) {
139     fProxy->generateFontMetrics(metrics);
140 }
141