Skip to content

Commit

Permalink
fix(style): update CSS to the latest
Browse files Browse the repository at this point in the history
KaTeX has some breaking changes in the recent versions. The font is not correctly applied.

fix #11
  • Loading branch information
craftzdog committed Jul 27, 2021
1 parent 245371e commit 4005a5d
Show file tree
Hide file tree
Showing 4 changed files with 666 additions and 558 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"dependencies": {
"@matejmazur/react-katex": "^3.1.3",
"katex": "^0.13.11",
"katex": "^0.13.13",
"trim-trailing-lines": "^1.1.4"
},
"devDependencies": {
Expand Down
90 changes: 51 additions & 39 deletions styles/fonts.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,60 +4,72 @@
@use-woff2: true;

.use-woff2(@family, @family-suffix) when (@use-woff2 = true) {
src+: url('@{font-folder}/KaTeX_@{family}-@{family-suffix}.woff2') format('woff2')
src+: url("@{font-folder}/KaTeX_@{family}-@{family-suffix}.woff2")
format("woff2");
}

.use-woff(@family, @family-suffix) when (@use-woff = true) {
src+: url('@{font-folder}/KaTeX_@{family}-@{family-suffix}.woff') format('woff')
src+: url("@{font-folder}/KaTeX_@{family}-@{family-suffix}.woff")
format("woff");
}

.use-ttf(@family, @family-suffix) when (@use-ttf = true) {
src+: url('@{font-folder}/KaTeX_@{family}-@{family-suffix}.ttf') format('truetype')
src+: url("@{font-folder}/KaTeX_@{family}-@{family-suffix}.ttf")
format("truetype");
}

.generate-suffix(@weight, @style) when (@weight = normal) and (@style = normal) {
@suffix: 'Regular';
.generate-suffix(@weight, @style)
when
(@weight = normal)
and
(@style = normal) {
@suffix: "Regular";
}
.generate-suffix(@weight, @style) when (@weight = normal) and (@style = italic) {
@suffix: 'Italic';
.generate-suffix(@weight, @style)
when
(@weight = normal)
and
(@style = italic) {
@suffix: "Italic";
}
.generate-suffix(@weight, @style) when (@weight = bold) and (@style = normal) {
@suffix: 'Bold';
@suffix: "Bold";
}
.generate-suffix(@weight, @style) when (@weight = bold) and (@style = italic) {
@suffix: 'BoldItalic';
@suffix: "BoldItalic";
}

.font-face(@family, @weight, @style) {
.generate-suffix(@weight, @style);
@font-face {
font-family: 'KaTeX_@{family}';
.use-woff2(@family, @suffix);
.use-woff(@family, @suffix);
.use-ttf(@family, @suffix);
font-weight: @weight;
font-style: @style;
}
.generate-suffix(@weight, @style);
@font-face {
font-family: "KaTeX_@{family}";
.use-woff2(@family, @suffix);
.use-woff(@family, @suffix);
.use-ttf(@family, @suffix);
font-weight: @weight;
font-style: @style;
}
}

.font-face('AMS', normal, normal);
.font-face('Caligraphic', bold, normal);
.font-face('Caligraphic', normal, normal);
.font-face('Fraktur', bold, normal);
.font-face('Fraktur', normal, normal);
.font-face('Main', bold, normal);
.font-face('Main', bold, italic);
.font-face('Main', normal, italic);
.font-face('Main', normal, normal);
// .font-face('Math', bold, italic);
.font-face('Math', normal, italic);
// .font-face('Math', normal, normal);
.font-face('SansSerif', bold, normal);
.font-face('SansSerif', normal, italic);
.font-face('SansSerif', normal, normal);
.font-face('Script', normal, normal);
.font-face('Size1', normal, normal);
.font-face('Size2', normal, normal);
.font-face('Size3', normal, normal);
.font-face('Size4', normal, normal);
.font-face('Typewriter', normal, normal);
.font-face("AMS", normal, normal);
.font-face("Caligraphic", bold, normal);
.font-face("Caligraphic", normal, normal);
.font-face("Fraktur", bold, normal);
.font-face("Fraktur", normal, normal);
.font-face("Main", bold, normal);
.font-face("Main", bold, italic);
.font-face("Main", normal, italic);
.font-face("Main", normal, normal);
//.font-face('Math', bold, normal);
.font-face("Math", bold, italic);
.font-face("Math", normal, italic);
//.font-face('Math', normal, normal);
.font-face("SansSerif", bold, normal);
.font-face("SansSerif", normal, italic);
.font-face("SansSerif", normal, normal);
.font-face("Script", normal, normal);
.font-face("Size1", normal, normal);
.font-face("Size2", normal, normal);
.font-face("Size3", normal, normal);
.font-face("Size4", normal, normal);
.font-face("Typewriter", normal, normal);
Loading

0 comments on commit 4005a5d

Please sign in to comment.