fix: wasm (#423)
parent
8ab5925bce
commit
cee207e407
|
@ -29,6 +29,8 @@ pub struct RunFonts {
|
|||
east_asia_theme: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
cs_theme: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
hint: Option<String>,
|
||||
}
|
||||
|
||||
impl RunFonts {
|
||||
|
@ -75,6 +77,11 @@ impl RunFonts {
|
|||
self.cs_theme = Some(f.into());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn hint(mut self, f: impl Into<String>) -> Self {
|
||||
self.hint = Some(f.into());
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl BuildXML for RunFonts {
|
||||
|
@ -89,6 +96,7 @@ impl BuildXML for RunFonts {
|
|||
self.hi_ansi_theme.as_ref(),
|
||||
self.cs_theme.as_ref(),
|
||||
self.east_asia_theme.as_ref(),
|
||||
self.hint.as_ref(),
|
||||
)
|
||||
.build()
|
||||
}
|
||||
|
|
|
@ -37,7 +37,9 @@ fn read_run_fonts(attributes: &[OwnedAttribute]) -> Result<RunFonts, ReaderError
|
|||
"cs" => {
|
||||
f = f.cs(&a.value);
|
||||
}
|
||||
|
||||
"hint" => {
|
||||
f = f.hint(&a.value);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ impl XMLBuilder {
|
|||
hi_ansi_theme: Option<&String>,
|
||||
cs_theme: Option<&String>,
|
||||
east_asia_theme: Option<&String>,
|
||||
hint: Option<&String>,
|
||||
) -> Self {
|
||||
let mut w = XmlEvent::start_element("w:rFonts");
|
||||
if let Some(ascii) = ascii {
|
||||
|
@ -60,6 +61,9 @@ impl XMLBuilder {
|
|||
if let Some(east_asia_theme) = east_asia_theme {
|
||||
w = w.attr("w:eastAsiaTheme", east_asia_theme);
|
||||
}
|
||||
if let Some(hint) = hint {
|
||||
w = w.attr("w:hint", hint);
|
||||
}
|
||||
self.writer.write(w).expect(EXPECT_MESSAGE);
|
||||
self.close()
|
||||
}
|
||||
|
@ -366,7 +370,13 @@ impl XMLBuilder {
|
|||
|
||||
open!(open_insert, "w:ins", "w:id", "w:author", "w:date");
|
||||
open!(open_delete, "w:del", "w:id", "w:author", "w:date");
|
||||
open!(open_paragraph_property_change, "w:pPrChange", "w:id", "w:author", "w:date");
|
||||
open!(
|
||||
open_paragraph_property_change,
|
||||
"w:pPrChange",
|
||||
"w:id",
|
||||
"w:author",
|
||||
"w:date"
|
||||
);
|
||||
|
||||
closed!(bookmark_start, "w:bookmarkStart", "w:id", "w:name");
|
||||
closed!(bookmark_end, "w:bookmarkEnd", "w:id");
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -20,6 +20,7 @@ export type RunFontsJSON = {
|
|||
hiAnsiTheme?: string;
|
||||
eastAsiaTheme?: string;
|
||||
csTheme?: string;
|
||||
hint?: string;
|
||||
};
|
||||
|
||||
export type RunPropertyJSON = {
|
||||
|
@ -37,8 +38,8 @@ export type RunPropertyJSON = {
|
|||
vanish?: boolean | null;
|
||||
spacing?: number | null;
|
||||
textBorder?: TextBorderJSON | null;
|
||||
ins?: InsertJSON['data'] | null;
|
||||
del?: DeleteJSON['data'] | null;
|
||||
ins?: InsertJSON["data"] | null;
|
||||
del?: DeleteJSON["data"] | null;
|
||||
strike?: boolean;
|
||||
};
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ export class RunFonts {
|
|||
_hiAnsiTheme?: string;
|
||||
_eastAsiaTheme?: string;
|
||||
_csTheme?: string;
|
||||
_hint?: string;
|
||||
|
||||
ascii(f: string) {
|
||||
this._ascii = f;
|
||||
|
@ -98,6 +99,11 @@ export class RunFonts {
|
|||
return this;
|
||||
}
|
||||
|
||||
hint(f: string) {
|
||||
this._hint = f;
|
||||
return this;
|
||||
}
|
||||
|
||||
buildWasmObject = () => {
|
||||
let f = wasm.createRunFonts();
|
||||
if (this?._ascii) {
|
||||
|
@ -112,6 +118,24 @@ export class RunFonts {
|
|||
if (this?._eastAsia) {
|
||||
f = f.east_asia(this._eastAsia);
|
||||
}
|
||||
|
||||
// theme
|
||||
if (this?._asciiTheme) {
|
||||
f = f.ascii_theme(this._asciiTheme);
|
||||
}
|
||||
if (this?._hiAnsiTheme) {
|
||||
f = f.hi_ansi_theme(this._hiAnsiTheme);
|
||||
}
|
||||
if (this?._csTheme) {
|
||||
f = f.cs_theme(this._csTheme);
|
||||
}
|
||||
if (this?._eastAsiaTheme) {
|
||||
f = f.east_asia_theme(this._eastAsiaTheme);
|
||||
}
|
||||
|
||||
if (this?._hint) {
|
||||
f = f.hint(this._hint);
|
||||
}
|
||||
return f;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -36,4 +36,29 @@ impl RunFonts {
|
|||
self.0 = self.0.east_asia(f);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn ascii_theme(mut self, f: String) -> Self {
|
||||
self.0 = self.0.ascii_theme(f);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn hi_ansi_theme(mut self, f: String) -> Self {
|
||||
self.0 = self.0.hi_ansi_theme(f);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn cs_theme(mut self, f: String) -> Self {
|
||||
self.0 = self.0.cs_theme(f);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn east_asia_theme(mut self, f: String) -> Self {
|
||||
self.0 = self.0.east_asia_theme(f);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn hint(mut self, f: String) -> Self {
|
||||
self.0 = self.0.hint(f);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue