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