font api supports for cross-platform

Signed-off-by: qugr <quguiren@huawei.com>
This commit is contained in:
qugr 2024-05-08 14:07:41 +08:00
parent 8985efaf1d
commit 1cb88f2e51

159
api/@ohos.font.d.ts vendored
View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
* Copyright (c) 2022-2024 Shenzhen Kaihong Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -29,6 +29,13 @@
* @atomicservice
* @since 11
*/
/**
* @namespace font
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
declare namespace font {
/**
* @typedef FontOptions
@ -41,6 +48,13 @@ declare namespace font {
* @atomicservice
* @since 11
*/
/**
* @typedef FontOptions
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
interface FontOptions {
/**
@ -65,6 +79,15 @@ declare namespace font {
* @atomicservice
* @since 11
*/
/**
* The font name to register.
*
* @type { string | Resource }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
familyName: string | Resource;
/**
@ -89,6 +112,15 @@ declare namespace font {
* @atomicservice
* @since 11
*/
/**
* The path of the font file.
*
* @type { string | Resource }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
familySrc: string | Resource;
}
@ -103,6 +135,13 @@ declare namespace font {
* @atomicservice
* @since 11
*/
/**
* @typedef FontInfo
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
interface FontInfo {
/**
@ -120,6 +159,15 @@ declare namespace font {
* @atomicservice
* @since 11
*/
/**
* The path of the font file.
*
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
path: string;
/**
@ -137,6 +185,15 @@ declare namespace font {
* @atomicservice
* @since 11
*/
/**
* The name of postscript.
*
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
postScriptName: string;
/**
@ -154,6 +211,15 @@ declare namespace font {
* @atomicservice
* @since 11
*/
/**
* The font name.
*
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
fullName: string;
/**
@ -171,6 +237,15 @@ declare namespace font {
* @atomicservice
* @since 11
*/
/**
* A set of fonts with a common design.
*
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
family: string;
/**
@ -188,6 +263,15 @@ declare namespace font {
* @atomicservice
* @since 11
*/
/**
* A subset of the font family.
*
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
subfamily: string;
/**
@ -205,6 +289,15 @@ declare namespace font {
* @atomicservice
* @since 11
*/
/**
* The weight of the font.
*
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
weight: number;
/**
@ -222,6 +315,15 @@ declare namespace font {
* @atomicservice
* @since 11
*/
/**
* The width of the font style.
*
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
width: number;
/**
@ -239,6 +341,15 @@ declare namespace font {
* @atomicservice
* @since 11
*/
/**
* Whether it is italic.
*
* @type { boolean }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
italic: boolean;
/**
@ -256,6 +367,15 @@ declare namespace font {
* @atomicservice
* @since 11
*/
/**
* Whether it is compact.
*
* @type { boolean }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
monoSpace: boolean;
/**
@ -273,6 +393,15 @@ declare namespace font {
* @atomicservice
* @since 11
*/
/**
* Whether symbol fonts are supported.
*
* @type { boolean }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
symbolic: boolean;
}
@ -582,6 +711,15 @@ declare namespace font {
* @atomicservice
* @since 11
*/
/**
* Register a customized font in the FontManager.
*
* @param { FontOptions } options - FontOptions
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
function registerFont(options: FontOptions): void;
/**
@ -599,6 +737,15 @@ declare namespace font {
* @atomicservice
* @since 11
*/
/**
* Gets a list of fonts supported by system.
*
* @returns { Array<string> } A list of font names
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
function getSystemFontList(): Array<string>;
/**
@ -618,6 +765,16 @@ declare namespace font {
* @atomicservice
* @since 11
*/
/**
* Get font details according to the font name.
*
* @param { string } fontName - font name
* @returns { FontInfo } Returns the font info
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
function getFontByName(fontName: string): FontInfo;
/**