1 /*
2  * Copyright (c) 2020-2021 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 #ifndef GLYPHS_MANAGER_FONT_H
17 #define GLYPHS_MANAGER_FONT_H
18 
19 #include "font/glyphs_file.h"
20 #include "font/ui_font_header.h"
21 #include "gfx_utils/heap_base.h"
22 #include "gfx_utils/vector.h"
23 
24 namespace OHOS {
25 class GlyphsManager : public HeapBase {
26 public:
27     GlyphsManager();
28 
29     GlyphsManager(const GlyphsManager&) = delete;
30 
31     GlyphsManager& operator=(const GlyphsManager&) = delete;
32 
33     ~GlyphsManager();
34 
35     int8_t GetFontVersion(const char* fontName, char* version, uint8_t len);
36 
37     int16_t GetFontHeight(uint16_t fontId);
38 
39     int16_t GetFontWidth(uint32_t unicode, uint16_t fontId);
40 
41     const FontHeader* GetFontHeader(uint16_t fontId);
42 
43     const GlyphNode* GetGlyphNode(uint32_t unicode, uint16_t fontId);
44 
45     const GlyphNode* GetGlyphNodeFromFiles(uint32_t unicode, uint16_t fontId);
46 
47     int8_t GetBitmap(uint32_t unicode, BufferInfo& bufInfo, uint16_t fontId);
48 
49     int8_t SetFile(const char* fontName, int32_t fp, uint32_t start, uint16_t fileType);
50 
51 private:
52     Graphic::Vector<GlyphsFile *> glyphsFiles_;
53     uint16_t fileType_;
54 };
55 } // namespace OHOS
56 #endif /* GLYPHS_MANAGER_FONT_H */
57