• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 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/**
17 * @file
18 * @kit LocalizationKit
19 */
20
21/**
22 * Provides the capability of install and uninstall font.
23 *
24 * @namespace fontManager
25 * @syscap SystemCapability.Global.FontManager
26 * @systemapi
27 * @since 19
28 */
29declare namespace fontManager {
30  /**
31   * Installs the specified path font.
32   *
33   * @permission ohos.permission.UPDATE_FONT
34   * @param { string } path - path indicates the font path.
35   * @returns { Promise<number> } - Number indicates the font installation result.
36   *        0 - Install successful.
37   * @throws { BusinessError } 201 - Permission denied.
38   * @throws { BusinessError } 202 - Non-system application.
39   * @throws { BusinessError } 31100101 - Font does not exist.
40   * @throws { BusinessError } 31100102 - Font is not supported.
41   * @throws { BusinessError } 31100103 - Font file copy failed.
42   * @throws { BusinessError } 31100104 - Font file installed.
43   * @throws { BusinessError } 31100105 - Exceeded maximum number of installed files.
44   * @throws { BusinessError } 31100106 - Other error.
45   * @syscap SystemCapability.Global.FontManager
46   * @systemapi
47   * @since 19
48   */
49  function installFont(path: string): Promise<number>;
50
51  /**
52   * Uninstalls the specified path font.
53   *
54   * @permission ohos.permission.UPDATE_FONT
55   * @param { string } fullName - fullName indicates the font name.
56   * @returns { Promise<number> } - number indicates the font uninstallation result.
57   *        0 - Uninstall successful.
58   * @throws { BusinessError } 201 - Permission denied.
59   * @throws { BusinessError } 202 - Non-system application.
60   * @throws { BusinessError } 31100107 - Font file does not exist.
61   * @throws { BusinessError } 31100108 - Font file delete error.
62   * @throws { BusinessError } 31100109 - Other error.
63   * @syscap SystemCapability.Global.FontManager
64   * @systemapi
65   * @since 19
66   */
67  function uninstallFont(fullName: string): Promise<number>;
68}
69export default fontManager;