Let fonts suit for more characters
This commit is contained in:
@ -34,7 +34,7 @@ describe("Numbering", () => {
|
|||||||
]);
|
]);
|
||||||
// Once chai 4.0.0 lands and #644 is resolved, we can add the following to the test:
|
// Once chai 4.0.0 lands and #644 is resolved, we can add the following to the test:
|
||||||
// {"w:lvlText": [{"_attr": {"w:val": "•"}}]},
|
// {"w:lvlText": [{"_attr": {"w:val": "•"}}]},
|
||||||
// {"w:rPr": [{"w:rFonts": [{"_attr": {"w:ascii": "Symbol", "w:hAnsi": "Symbol", "w:hint": "default"}}]}]},
|
// {"w:rPr": [{"w:rFonts": [{"_attr": {"w:ascii": "Symbol", "w:cs": "Symbol", "w:eastAsia": "Symbol", "w:hAnsi": "Symbol", "w:hint": "default"}}]}]},
|
||||||
// {"w:pPr": [{"_attr": {}},
|
// {"w:pPr": [{"_attr": {}},
|
||||||
// {"w:ind": [{"_attr": {"w:left": 720, "w:hanging": 360}}]}]},
|
// {"w:ind": [{"_attr": {"w:left": 720, "w:hanging": 360}}]}]},
|
||||||
});
|
});
|
||||||
@ -297,7 +297,7 @@ describe("AbstractNumbering", () => {
|
|||||||
const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").font("Times");
|
const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").font("Times");
|
||||||
const tree = new Formatter().format(level);
|
const tree = new Formatter().format(level);
|
||||||
expect(tree["w:lvl"]).to.include({
|
expect(tree["w:lvl"]).to.include({
|
||||||
"w:rPr": [{ "w:rFonts": [{ _attr: { "w:ascii": "Times", "w:hAnsi": "Times" } }] }],
|
"w:rPr": [{ "w:rFonts": [{ _attr: { "w:ascii": "Times", "w:cs": "Times", "w:eastAsia": "Times", "w:hAnsi": "Times" } }] }],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -8,14 +8,14 @@ describe("RunFonts", () => {
|
|||||||
it("uses the font name for both ascii and hAnsi", () => {
|
it("uses the font name for both ascii and hAnsi", () => {
|
||||||
const tree = new Formatter().format(new RunFonts("Times"));
|
const tree = new Formatter().format(new RunFonts("Times"));
|
||||||
expect(tree).to.deep.equal({
|
expect(tree).to.deep.equal({
|
||||||
"w:rFonts": [{ _attr: { "w:ascii": "Times", "w:hAnsi": "Times" } }],
|
"w:rFonts": [{ _attr: { "w:ascii": "Times", "w:cs": "Times", "w:eastAsia": "Times", "w:hAnsi": "Times" } }],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("uses hint if given", () => {
|
it("uses hint if given", () => {
|
||||||
const tree = new Formatter().format(new RunFonts("Times", "default"));
|
const tree = new Formatter().format(new RunFonts("Times", "default"));
|
||||||
expect(tree).to.deep.equal({
|
expect(tree).to.deep.equal({
|
||||||
"w:rFonts": [{ _attr: { "w:ascii": "Times", "w:hAnsi": "Times", "w:hint": "default" } }],
|
"w:rFonts": [{ _attr: { "w:ascii": "Times", "w:cs": "Times", "w:eastAsia": "Times", "w:hAnsi": "Times", "w:hint": "default" } }],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -2,6 +2,8 @@ import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
|||||||
|
|
||||||
interface IRunFontAttributesProperties {
|
interface IRunFontAttributesProperties {
|
||||||
ascii: string;
|
ascii: string;
|
||||||
|
cs: string;
|
||||||
|
eastAsia: string;
|
||||||
hAnsi: string;
|
hAnsi: string;
|
||||||
hint?: string;
|
hint?: string;
|
||||||
}
|
}
|
||||||
@ -9,6 +11,8 @@ interface IRunFontAttributesProperties {
|
|||||||
class RunFontAttributes extends XmlAttributeComponent<IRunFontAttributesProperties> {
|
class RunFontAttributes extends XmlAttributeComponent<IRunFontAttributesProperties> {
|
||||||
protected xmlKeys = {
|
protected xmlKeys = {
|
||||||
ascii: "w:ascii",
|
ascii: "w:ascii",
|
||||||
|
cs: "w:cs",
|
||||||
|
eastAsia: "w:eastAsia",
|
||||||
hAnsi: "w:hAnsi",
|
hAnsi: "w:hAnsi",
|
||||||
hint: "w:hint",
|
hint: "w:hint",
|
||||||
};
|
};
|
||||||
@ -20,6 +24,8 @@ export class RunFonts extends XmlComponent {
|
|||||||
this.root.push(
|
this.root.push(
|
||||||
new RunFontAttributes({
|
new RunFontAttributes({
|
||||||
ascii: ascii,
|
ascii: ascii,
|
||||||
|
cs: ascii,
|
||||||
|
eastAsia: ascii,
|
||||||
hAnsi: ascii,
|
hAnsi: ascii,
|
||||||
hint: hint,
|
hint: hint,
|
||||||
}),
|
}),
|
||||||
|
@ -108,7 +108,7 @@ describe("Run", () => {
|
|||||||
run.font("Times");
|
run.font("Times");
|
||||||
const tree = new Formatter().format(run);
|
const tree = new Formatter().format(run);
|
||||||
expect(tree).to.deep.equal({
|
expect(tree).to.deep.equal({
|
||||||
"w:r": [{ "w:rPr": [{ "w:rFonts": [{ _attr: { "w:ascii": "Times", "w:hAnsi": "Times" } }] }] }],
|
"w:r": [{ "w:rPr": [{ "w:rFonts": [{ _attr: { "w:ascii": "Times", "w:cs": "Times", "w:eastAsia": "Times", "w:hAnsi": "Times" } }] }] }],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -459,7 +459,7 @@ describe("ParagraphStyle", () => {
|
|||||||
"w:style": [
|
"w:style": [
|
||||||
{ _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } },
|
{ _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } },
|
||||||
{ "w:pPr": [] },
|
{ "w:pPr": [] },
|
||||||
{ "w:rPr": [{ "w:rFonts": [{ _attr: { "w:ascii": "Times", "w:hAnsi": "Times" } }] }] },
|
{ "w:rPr": [{ "w:rFonts": [{ _attr: { "w:ascii": "Times", "w:cs": "Times", "w:eastAsia": "Times", "w:hAnsi": "Times" } }] }] },
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user