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 #include "ui_text_language.h"
16 #include "font/ui_font_builder.h"
17 #include "font/ui_font_header.h"
18
19 namespace OHOS {
20 static const UITextLanguageFontParam g_uiTextLangFontsTable[LANGUAGE_FONT_ID_MAX] = {
21 {14, 4, 0, 0, "RobotoCondensed-Regular"},
22 {18, 4, 0, 0, "RobotoCondensed-Regular"},
23 {20, 4, 0, 0, "RobotoCondensed-Regular"},
24 {23, 4, 0, 0, "RobotoCondensed-Regular"},
25 {24, 4, 0, 0, "RobotoCondensed-Regular"},
26 {26, 4, 0, 0, "RobotoCondensed-Regular"},
27 {28, 4, 0, 0, "RobotoCondensed-Regular"},
28 {30, 4, 0, 0, "RobotoCondensed-Regular"},
29 {38, 4, 0, 0, "RobotoCondensed-Regular"},
30 {48, 4, 0, 0, "RobotoCondensed-Regular"},
31 {14, 4, 0, 1, "SourceHanSansSC-Regular"},
32 {16, 4, 0, 1, "SourceHanSansSC-Regular"},
33 {18, 4, 0, 1, "SourceHanSansSC-Regular"},
34 {20, 4, 0, 1, "SourceHanSansSC-Regular"},
35 {24, 4, 0, 1, "SourceHanSansSC-Regular"},
36 {26, 4, 0, 1, "SourceHanSansSC-Regular"},
37 {30, 4, 0, 1, "SourceHanSansSC-Regular"},
38 {38, 4, 0, 1, "SourceHanSansSC-Regular"},
39 }; // g_uiTextLangFontsTable
40
41 static const LangTextParam g_langTextDefaultParamTable[LANGUAGE_MAX] = {
42 {0, 30, "SourceHanSansSC-Regular", "zh"},
43 {0, 30, "RobotoCondensed-Regular", "en"},
44 {0, 30, "RobotoCondensed-Regular", "en"},
45 }; // g_langTextDefaultParamTable
46
BitmapFontInit()47 void BitmapFontInit()
48 {
49 UIFontBuilder* uiFontBuilder = UIFontBuilder::GetInstance();
50 if (uiFontBuilder == nullptr) {
51 return;
52 }
53 uiFontBuilder->SetTextLangFontsTable(g_uiTextLangFontsTable, LANGUAGE_FONT_ID_MAX);
54 uiFontBuilder->SetLangTextDefaultParamTable(g_langTextDefaultParamTable, LANGUAGE_MAX);
55 uiFontBuilder->SetMaxTextId(LANGUAGE_TEXT_ID_MAX);
56 }
57 } // namespace OHOS
58