cn_font_proto/
api_interface.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct InputTemplate {
4    /// ttf 文件的 buffer
5    #[prost(bytes = "vec", tag = "1")]
6    pub input: ::prost::alloc::vec::Vec<u8>,
7    /// 切割后放置文件的文件夹
8    #[prost(string, optional, tag = "2")]
9    pub out_dir: ::core::option::Option<::prost::alloc::string::String>,
10    /// CSS 配置
11    #[prost(message, optional, tag = "5")]
12    pub css: ::core::option::Option<input_template::CssProperties>,
13    /// 目标类型
14    #[prost(string, optional, tag = "6")]
15    pub target_type: ::core::option::Option<::prost::alloc::string::String>,
16    /// 子集
17    #[prost(bytes = "vec", repeated, tag = "7")]
18    pub subsets: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
19    /// 包大小
20    #[prost(int32, optional, tag = "9")]
21    pub chunk_size: ::core::option::Option<i32>,
22    /// 包大小容差
23    #[prost(float, optional, tag = "10")]
24    pub chunk_size_tolerance: ::core::option::Option<f32>,
25    /// 最大允许子集数量
26    #[prost(int32, optional, tag = "11")]
27    pub max_allow_subsets_count: ::core::option::Option<i32>,
28    /// 是否生成测试 HTML
29    #[prost(bool, optional, tag = "13")]
30    pub test_html: ::core::option::Option<bool>,
31    /// 是否生成 reporter.bin
32    #[prost(bool, optional, tag = "14")]
33    pub reporter: ::core::option::Option<bool>,
34    /// 预览图像
35    #[prost(message, optional, tag = "15")]
36    pub preview_image: ::core::option::Option<input_template::PreviewImage>,
37    /// 重命名输出字体
38    #[prost(string, optional, tag = "18")]
39    pub rename_output_font: ::core::option::Option<::prost::alloc::string::String>,
40    /// TODO 构建模式
41    #[prost(string, optional, tag = "20")]
42    pub build_mode: ::core::option::Option<::prost::alloc::string::String>,
43    /// 是否进行语言区域优化
44    #[prost(bool, optional, tag = "8")]
45    pub language_areas: ::core::option::Option<bool>,
46    /// TODO 是否使用多线程
47    #[prost(bool, optional, tag = "21")]
48    pub multi_threads: ::core::option::Option<bool>,
49    /// 是否启用字体特性
50    #[prost(bool, optional, tag = "22")]
51    pub font_feature: ::core::option::Option<bool>,
52    /// TODO 是否减少最小分包,
53    #[prost(bool, optional, tag = "23")]
54    pub reduce_mins: ::core::option::Option<bool>,
55    /// 是否自动子集化
56    #[prost(bool, optional, tag = "24")]
57    pub auto_subset: ::core::option::Option<bool>,
58    /// 是否自动添加没有声明的字符
59    #[prost(bool, optional, tag = "25")]
60    pub subset_remain_chars: ::core::option::Option<bool>,
61}
62/// Nested message and enum types in `InputTemplate`.
63pub mod input_template {
64    /// CSS 属性配置
65    #[derive(Clone, PartialEq, ::prost::Message)]
66    pub struct CssProperties {
67        /// 字体家族名称
68        #[prost(string, optional, tag = "1")]
69        pub font_family: ::core::option::Option<::prost::alloc::string::String>,
70        /// 字体粗细
71        #[prost(string, optional, tag = "2")]
72        pub font_weight: ::core::option::Option<::prost::alloc::string::String>,
73        /// 字体样式
74        #[prost(string, optional, tag = "3")]
75        pub font_style: ::core::option::Option<::prost::alloc::string::String>,
76        /// 字体显示方式
77        #[prost(string, optional, tag = "4")]
78        pub font_display: ::core::option::Option<::prost::alloc::string::String>,
79        /// 本地字体家族名称
80        #[prost(string, repeated, tag = "5")]
81        pub local_family: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
82        /// Polyfill 类型
83        #[prost(message, repeated, tag = "6")]
84        pub polyfill: ::prost::alloc::vec::Vec<PolyfillType>,
85        /// 基础注释
86        #[prost(bool, optional, tag = "11")]
87        pub comment_base: ::core::option::Option<bool>,
88        /// 名称表注释
89        #[prost(bool, optional, tag = "12")]
90        pub comment_name_table: ::core::option::Option<bool>,
91        /// Unicode 注释
92        #[prost(bool, optional, tag = "13")]
93        pub comment_unicodes: ::core::option::Option<bool>,
94        /// 是否压缩
95        #[prost(bool, optional, tag = "8")]
96        pub compress: ::core::option::Option<bool>,
97        /// 文件名
98        #[prost(string, optional, tag = "9")]
99        pub file_name: ::core::option::Option<::prost::alloc::string::String>,
100    }
101    /// Polyfill 类型
102    #[derive(Clone, PartialEq, ::prost::Message)]
103    pub struct PolyfillType {
104        /// 名称
105        #[prost(string, tag = "1")]
106        pub name: ::prost::alloc::string::String,
107        /// 格式
108        #[prost(string, tag = "2")]
109        pub format: ::prost::alloc::string::String,
110    }
111    /// 预览图像
112    #[derive(Clone, PartialEq, ::prost::Message)]
113    pub struct PreviewImage {
114        /// 会显示在 svg 中的文本
115        #[prost(string, tag = "1")]
116        pub text: ::prost::alloc::string::String,
117        /// svg 文件的名称
118        #[prost(string, tag = "2")]
119        pub name: ::prost::alloc::string::String,
120    }
121}
122#[derive(Clone, PartialEq, ::prost::Message)]
123pub struct EventMessage {
124    #[prost(enumeration = "EventName", tag = "1")]
125    pub event: i32,
126    #[prost(string, tag = "2")]
127    pub message: ::prost::alloc::string::String,
128    #[prost(bytes = "vec", optional, tag = "3")]
129    pub data: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
130}
131#[derive(Clone, PartialEq, ::prost::Message)]
132pub struct MultiMessages {
133    #[prost(message, repeated, tag = "1")]
134    pub messages: ::prost::alloc::vec::Vec<EventMessage>,
135}
136#[derive(Clone, PartialEq, ::prost::Message)]
137pub struct OutputReport {
138    /// 版本号
139    #[prost(string, tag = "1")]
140    pub version: ::prost::alloc::string::String,
141    /// CSS相关信息,可以直接用
142    #[prost(message, optional, tag = "2")]
143    pub css: ::core::option::Option<output_report::Css>,
144    /// 平台信息,rust 的构建平台
145    #[prost(string, tag = "3")]
146    pub platform: ::prost::alloc::string::String,
147    /// 构建消息
148    #[prost(message, optional, tag = "24")]
149    pub bundle_message: ::core::option::Option<output_report::BundleMessage>,
150    /// name 表信息
151    #[prost(message, repeated, tag = "25")]
152    pub name_table: ::prost::alloc::vec::Vec<output_report::NameTable>,
153    /// 子集详情
154    #[prost(message, repeated, tag = "26")]
155    pub subset_detail: ::prost::alloc::vec::Vec<output_report::SubsetDetail>,
156}
157/// Nested message and enum types in `OutputReport`.
158pub mod output_report {
159    #[derive(Clone, PartialEq, ::prost::Message)]
160    pub struct NameTable {
161        /// 平台
162        #[prost(string, tag = "1")]
163        pub platform: ::prost::alloc::string::String,
164        /// 语言
165        #[prost(string, tag = "2")]
166        pub language: ::prost::alloc::string::String,
167        /// 名称
168        #[prost(string, tag = "3")]
169        pub name: ::prost::alloc::string::String,
170        /// 值
171        #[prost(string, tag = "4")]
172        pub value: ::prost::alloc::string::String,
173    }
174    #[derive(Clone, PartialEq, ::prost::Message)]
175    pub struct SubsetDetail {
176        /// ID
177        #[prost(uint32, tag = "1")]
178        pub id: u32,
179        /// 哈希值
180        #[prost(string, tag = "2")]
181        pub hash: ::prost::alloc::string::String,
182        /// 文件名称
183        #[prost(string, tag = "6")]
184        pub file_name: ::prost::alloc::string::String,
185        /// 字节数
186        #[prost(uint32, tag = "3")]
187        pub bytes: u32,
188        /// 字符数组
189        #[prost(uint32, repeated, tag = "4")]
190        pub chars: ::prost::alloc::vec::Vec<u32>,
191        /// 构建时间
192        #[prost(uint32, tag = "5")]
193        pub duration: u32,
194    }
195    #[derive(Clone, Copy, PartialEq, ::prost::Message)]
196    pub struct BundleMessage {
197        /// 原始大小
198        #[prost(uint32, tag = "1")]
199        pub origin_size: u32,
200        /// 产物大小
201        #[prost(uint32, tag = "2")]
202        pub bundled_size: u32,
203        /// 原始字节数
204        #[prost(uint32, tag = "3")]
205        pub origin_bytes: u32,
206        /// 产物字节数
207        #[prost(uint32, tag = "4")]
208        pub bundled_bytes: u32,
209    }
210    #[derive(Clone, PartialEq, ::prost::Message)]
211    pub struct Css {
212        /// 字体家族
213        #[prost(string, tag = "1")]
214        pub family: ::prost::alloc::string::String,
215        /// 样式
216        #[prost(string, tag = "2")]
217        pub style: ::prost::alloc::string::String,
218        /// 字重
219        #[prost(string, tag = "3")]
220        pub weight: ::prost::alloc::string::String,
221        /// 显示方式
222        #[prost(string, tag = "4")]
223        pub display: ::prost::alloc::string::String,
224    }
225}
226#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
227#[repr(i32)]
228pub enum EventName {
229    Unspecified = 0,
230    /// "output_data"
231    OutputData = 1,
232    /// "end"
233    End = 2,
234}
235impl EventName {
236    /// String value of the enum field names used in the ProtoBuf definition.
237    ///
238    /// The values are not transformed in any way and thus are considered stable
239    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
240    pub fn as_str_name(&self) -> &'static str {
241        match self {
242            Self::Unspecified => "UNSPECIFIED",
243            Self::OutputData => "OUTPUT_DATA",
244            Self::End => "END",
245        }
246    }
247    /// Creates an enum from field names used in the ProtoBuf definition.
248    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
249        match value {
250            "UNSPECIFIED" => Some(Self::Unspecified),
251            "OUTPUT_DATA" => Some(Self::OutputData),
252            "END" => Some(Self::End),
253            _ => None,
254        }
255    }
256}