Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Move fonts.less from Khan/KaTeX #10

Merged
merged 11 commits into from
Jan 29, 2018
Merged

Move fonts.less from Khan/KaTeX #10

merged 11 commits into from
Jan 29, 2018

Conversation

kevinbarabash
Copy link
Member

Summary:
This will allow us to remove the symlink from Khan/KaTeX to
this repo's font folder without changing any of the paths in
fonts.less.

Test Plan:

  • npm run prepublishOnly (in Khan/KaTeX)
  • see that it puts the fonts in the correct folders in build

Emily Eisenberg and others added 9 commits September 22, 2014 14:23
Summary:
Create a fonts.less file which generates identical css to fonts.css, but using
less rules to be more understandable and customizable. For example, add the
ability to change where the fonts directory is located (instead of mandating it
be located next to the less file), and add the ability to disable specific font
formats (like disable EOTs when IE8 support isn't needed).

Test Plan:
 - Ensure that the test page and huxley page still work
 - Ensure that the output of `./node_modules/.bin/lessc static/fonts.less` is
   the same as the original css by running both through
   `./node_modules/.bin/cleancss` and diffing them.
 - Ensure that the huxley screenshots haven't changed
 - Ensure that the build step still works

Reviewers: alpert

Reviewed By: alpert

Differential Revision: http://phabricator.khanacademy.org/D13326
Contrary to other web font formats, the new WOFF 2.0 Web Font compression format is optimized for file size, memory usage, and decompression speed.

WOFF2 has been supported in Chrome and Opera for a while now. See https://dev.opera.com/blog/opera-23/ for more info.
Add WOFF2 versions of the fonts
Summary: Fixes #207.

Test Plan: Crossed fingers.

Reviewers: emily

Reviewed By: emily

Differential Revision: https://phabricator.khanacademy.org/D16871
This is part 1 of 3.  Rendering, screenshots, MathML, and unit tests will
follow in susbequent pull requests.
Adds font metrics to support font commands.
Summary:
I've been experimenting with delivering a TrueType-only KaTeX build for our mobile apps. I couldn't
get anything to render properly until I flipped the `format` specifier from `ttf` to `truetype`.
Though I can't find a definitive source on this, all the examples I've seen online use `truetype`
over `ttf`, and flipping from `ttf` to `truetype` fixed my own issues.

It's unlikely that this has been much of a problem in practice, since so many browsers now support
WOFF (I'm considering a TrueType-only build since it's the least common denominator across Android
4.3+ and mobile Safari).

Test Plan:
- To force TrueType rendering, comment out the `.use-eot`, `.use-woff2`, and `.use-woff` lines in `fonts.less`.
- Run `make serve`.
- Open up the demo page.
    - Verify that the demo text is rendered as before (only the parens are noticeably different in the demo?).

Reviewers: kevinb, emily

Reviewed By: emily

Subscribers: benkomalo

Differential Revision: https://phabricator.khanacademy.org/D29274
@ylemkimon
Copy link
Member

ylemkimon commented Jan 25, 2018

I think original Git history should be preserved. Also, this repo seems to be missing a LICENSE.

@kevinbarabash
Copy link
Member Author

@ylemkimon I'm not sure how to migrate the git history. Do you know how? I will definitely add a LICENSE file.

@ylemkimon
Copy link
Member

ylemkimon commented Jan 27, 2018

I think we can rewrite git history only for fonts.less and merge it like:

git clone https://github.com/Khan/KaTeX.git
cd KaTeX
git remote rm origin # to prevent from accidental push
git filter-branch --prune-empty --subdirectory-filter static -- --all
git filter-branch -f --prune-empty --index-filter "git rm --cached --ignore-unmatch $(git ls-files | grep -v 'fonts.less')" # single/double quote handling may differ
cd ..
git clone https://github.com/KaTeX/katex-fonts.git
cd katex-fonts
git checkout -b <branch name>
git remote add KaTeX ../KaTeX
git fetch KaTeX
git branch KaTeX remotes/KaTeX/master
git merge --allow-unrelated-histories KaTeX
git remote rm KaTeX

@kevinbarabash
Copy link
Member Author

@ylemkimon thanks for the gitfu. It worked like a charm except for the --index-filter command. I had to change it to:

git filter-branch -f --prune-empty --index-filter 'git rm --cached --ignore-unmatch $(git ls-files | grep -v fonts.less)'

@kevinbarabash kevinbarabash merged commit 28bac26 into master Jan 29, 2018
@kevinbarabash kevinbarabash mentioned this pull request Feb 2, 2018
3 tasks
@ylemkimon ylemkimon deleted the fonts_less branch June 28, 2018 18:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants