1/* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16#include "ui_font_vector.h" 17 18namespace { 19 int8_t defaultRetVal = 1; 20} 21 22namespace OHOS { 23 UIFontVector::UIFontVector() {} 24 25 UIFontVector::~UIFontVector() {} 26 27 bool UIFontVector::IsColorEmojiFont(FT_Face& face) 28 { 29 return true; 30 } 31 32 int8_t SetupColorFont(FT_Face face, uint8_t fontSize) 33 { 34 return defaultRetVal; 35 } 36 37 uint8_t UIFontVector::RegisterFontInfo(const char* ttfName, uint8_t shaping) 38 { 39 return defaultRetVal; 40 } 41 42 uint8_t UIFontVector::RegisterFontInfo(const UITextLanguageFontParam* fontsTable, uint8_t num) 43 { 44 return defaultRetVal; 45 } 46 47 uint8_t UIFontVector::RegisterTtcFontInfo(const char* ttcName, const TtfInfo* ttfInfo, uint8_t count) 48 { 49 return defaultRetVal; 50 } 51 52 uint8_t UIFontVector::UnregisterTtcFontInfo(const char* ttcName, const TtfInfo* ttfInfo, uint8_t count) 53 { 54 return defaultRetVal; 55 } 56 57 uint8_t UIFontVector::UnregisterFontInfo(const UITextLanguageFontParam* fontsTable, uint8_t num) 58 { 59 return defaultRetVal; 60 } 61 62 uint8_t UIFontVector::UnregisterFontInfo(const char* ttfName) 63 { 64 return defaultRetVal; 65 } 66 67 const UITextLanguageFontParam* UIFontVector::GetFontInfo(uint16_t fontId) const 68 { 69 return nullptr; 70 } 71 72 int32_t UIFontVector::OpenVectorFont(uint8_t ttfId) 73 { 74 return defaultRetVal; 75 } 76 77 bool UIFontVector::GetTtfInfo(uint8_t ttfId, uint8_t* ttfBuffer, uint32_t ttfBufferSize, TtfHeader& ttfHeader) 78 { 79 return true; 80 } 81 82 bool UIFontVector::GetTtfInfoFromTtf(uint8_t* ttfBuffer, uint32_t ttfBufferSize, TtfHeader& ttfHeader, 83 UITextLanguageFontParam fontInfo) 84 { 85 return true; 86 } 87 88 struct TtcHeader { 89 uint32_t ttcTag; 90 uint16_t major; 91 uint16_t minor; 92 int32_t numFonts; 93 }; 94 95 bool UIFontVector::GetTtfInfoFromTtc(uint8_t* ttfBuffer, uint32_t ttfBufferSize, TtfHeader& ttfHeader, 96 UITextLanguageFontParam fontInfo) 97 { 98 return true; 99 } 100 101 bool UIFontVector::IsVectorFont() const 102 { 103 return true; 104 } 105 106 uint8_t UIFontVector::GetFontWeight(uint16_t fontId) 107 { 108 return defaultRetVal; 109 } 110 111 int8_t UIFontVector::SetFontPath(const char* path, FontType type) 112 { 113 return defaultRetVal; 114 } 115 116 int8_t UIFontVector::GetFaceInfo(uint16_t fontId, uint8_t fontSize, FaceInfo& faceInfo) 117 { 118 return defaultRetVal; 119 } 120 121 uint16_t UIFontVector::GetHeight(uint16_t fontId, uint8_t fontSize) 122 { 123 return defaultRetVal; 124 } 125 126 uint16_t UIFontVector::GetShapingFontId(char* text, uint8_t& ttfId, uint32_t& script, 127 uint16_t fontId, uint8_t size) const 128 { 129 return defaultRetVal; 130 } 131 132 uint16_t UIFontVector::GetFontId(const char* ttfName, uint8_t fontSize) const 133 { 134 return defaultRetVal; 135 } 136 137 uint16_t UIFontVector::GetFontId(uint32_t unicode) const 138 { 139 return defaultRetVal; 140 } 141 142 int16_t UIFontVector::GetWidth(uint32_t unicode, uint16_t fontId, uint8_t fontSize) 143 { 144 return defaultRetVal; 145 } 146 147 int8_t UIFontVector::GetFontHeader(FontHeader& fontHeader, uint16_t fontId, uint8_t fontSize) 148 { 149 return defaultRetVal; 150 } 151 152 void UIFontVector::SaveGlyphNode(uint32_t unicode, uint16_t fontKey, Metric *metric) {} 153 154 int8_t UIFontVector::GetGlyphNode(uint32_t unicode, GlyphNode& glyphNode, uint16_t fontId, uint8_t fontSize) 155 { 156 return defaultRetVal; 157 } 158 159 uint8_t* UIFontVector::GetBitmap(uint32_t unicode, GlyphNode& glyphNode, uint16_t fontId, uint8_t fontSize) 160 { 161 return nullptr; 162 } 163 164 bool UIFontVector::IsEmojiFont(uint16_t fontId) 165 { 166 return true; 167 } 168 169 uint8_t UIFontVector::IsGlyphFont(uint32_t unicode) 170 { 171 return defaultRetVal; 172 } 173 174 void UIFontVector::SetFace(FaceInfo& faceInfo, uint32_t unicode) {} 175 176 void UIFontVector::SetFace(FaceInfo& faceInfo, uint32_t unicode, TextStyle textStyle) {} 177 178 void UIFontVector::ClearFontGlyph(FT_Face face) {} 179 180 inline uint16_t UIFontVector::GetKey(uint16_t fontId, uint8_t size) 181 { 182 return defaultRetVal; 183 } 184 185 uint16_t UIFontVector::GetOffsetPosY(const char* text, uint16_t lineLength, bool& isEmojiLarge, 186 uint16_t fontId, uint8_t fontSize) 187 { 188 return defaultRetVal; 189 } 190 191 uint16_t UIFontVector::GetLineMaxHeight(const char* text, uint16_t lineLength, uint16_t fontId, 192 uint8_t fontSize, uint16_t& letterIndex, SpannableString* spannableString) 193 { 194 return defaultRetVal; 195 } 196 197 uint16_t UIFontVector::GetMaxSubLineHeight(uint16_t textNum, uint16_t loopNum, uint16_t maxHeight, 198 uint16_t emojiNum) 199 { 200 return defaultRetVal; 201 } 202 203 void UIFontVector::SetPsramMemory(uintptr_t psramAddr, uint32_t psramLen) {} 204 205 int8_t UIFontVector::SetCurrentLangId(uint8_t langId) 206 { 207 return defaultRetVal; 208 } 209} // namespace OHOS 210