parent
00aecc91e0
commit
6ed69bdf5d
|
@ -193,7 +193,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "docx-rs"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
dependencies = [
|
||||
"image 0.23.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"insta 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -210,7 +210,7 @@ dependencies = [
|
|||
name = "docx-wasm"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"docx-rs 0.2.2",
|
||||
"docx-rs 0.2.3",
|
||||
"wasm-bindgen 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasm-bindgen-test 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "docx-rs"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
authors = ["bokuweb <bokuweb12@gmail.com>"]
|
||||
repository = "https://github.com/bokuweb/docx-rs"
|
||||
edition = "2018"
|
||||
|
|
|
@ -126,6 +126,21 @@ export class Docx {
|
|||
run = run.vanish();
|
||||
}
|
||||
|
||||
let f = wasm.createRunFonts();
|
||||
if (r.property.fonts?._ascii) {
|
||||
f = f.ascii(r.property.fonts._ascii);
|
||||
}
|
||||
if (r.property.fonts?._hiAnsi) {
|
||||
f = f.hi_ansi(r.property.fonts._hiAnsi);
|
||||
}
|
||||
if (r.property.fonts?._cs) {
|
||||
f = f.cs(r.property.fonts._cs);
|
||||
}
|
||||
if (r.property.fonts?._eastAsia) {
|
||||
f = f.east_asia(r.property.fonts._eastAsia);
|
||||
}
|
||||
run = run.fonts(f);
|
||||
|
||||
return run;
|
||||
}
|
||||
|
||||
|
@ -253,17 +268,17 @@ export class Docx {
|
|||
|
||||
if (p.property.runProperty.fonts) {
|
||||
let f = wasm.createRunFonts();
|
||||
if (p.property.runProperty.fonts.ascii) {
|
||||
f = f.ascii(p.property.runProperty.fonts.ascii);
|
||||
if (p.property.runProperty.fonts._ascii) {
|
||||
f = f.ascii(p.property.runProperty.fonts._ascii);
|
||||
}
|
||||
if (p.property.runProperty.fonts.hiAnsi) {
|
||||
f = f.hi_ansi(p.property.runProperty.fonts.hiAnsi);
|
||||
if (p.property.runProperty.fonts._hiAnsi) {
|
||||
f = f.hi_ansi(p.property.runProperty.fonts._hiAnsi);
|
||||
}
|
||||
if (p.property.runProperty.fonts.cs) {
|
||||
f = f.cs(p.property.runProperty.fonts.cs);
|
||||
if (p.property.runProperty.fonts._cs) {
|
||||
f = f.cs(p.property.runProperty.fonts._cs);
|
||||
}
|
||||
if (p.property.runProperty.fonts.eastAsia) {
|
||||
f = f.east_asia(p.property.runProperty.fonts.eastAsia);
|
||||
if (p.property.runProperty.fonts._eastAsia) {
|
||||
f = f.east_asia(p.property.runProperty.fonts._eastAsia);
|
||||
}
|
||||
paragraph = paragraph.fonts(f);
|
||||
}
|
||||
|
|
|
@ -16,12 +16,32 @@ export type RunProperty = {
|
|||
fonts?: RunFonts;
|
||||
};
|
||||
|
||||
export type RunFonts = {
|
||||
ascii?: string;
|
||||
hiAnsi?: string;
|
||||
eastAsia?: string;
|
||||
cs?: string;
|
||||
};
|
||||
export class RunFonts {
|
||||
_ascii?: string;
|
||||
_hiAnsi?: string;
|
||||
_eastAsia?: string;
|
||||
_cs?: string;
|
||||
|
||||
ascii(f: string) {
|
||||
this._ascii = f;
|
||||
return this;
|
||||
}
|
||||
|
||||
hiAnsi(f: string) {
|
||||
this._hiAnsi = f;
|
||||
return this;
|
||||
}
|
||||
|
||||
cs(f: string) {
|
||||
this._cs = f;
|
||||
return this;
|
||||
}
|
||||
|
||||
eastAsia(f: string) {
|
||||
this._eastAsia = f;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
export class Run {
|
||||
children: RunChild[] = [];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "docx-wasm",
|
||||
"version": "0.0.77",
|
||||
"version": "0.0.80",
|
||||
"main": "dist/node/index.js",
|
||||
"browser": "dist/web/index.js",
|
||||
"author": "bokuweb <bokuweb12@gmail.com>",
|
||||
|
|
Loading…
Reference in New Issue