quarto-ext / fontawesome

Use Font Awesome icons in HTML and PDF documents.
https://quarto-ext.github.io/fontawesome/
MIT License
109 stars 10 forks source link

Typos, sizing & Accessibility #10

Closed mcanouil closed 2 years ago

mcanouil commented 2 years ago

This PR does:

cscheid commented 2 years ago

Hi @mcanouil - can you please reopen this with only the .lua changes?

Sorry for the delay, GitHub didn't add me as a repo watcher so I missed these :(

mcanouil commented 2 years ago

@cscheid This would also remove the examples added to highlight lua's changes. I can just rebase/merge to include the PR you merged.

cscheid commented 2 years ago

That works too.

mcanouil commented 2 years ago

@cscheid no more conflicts in the PR. By the way do you have an opinion on this https://github.com/quarto-ext/fontawesome/issues/8#issuecomment-1192845950) regarding accessibility?

cscheid commented 2 years ago

How do these HTML changes behave in the PDF format?

mcanouil commented 2 years ago

Since the latex package for FA does not account for these parameters, they are only for HTML outputs, e.g., exactly as "group" added by @jjallaire

https://github.com/mcanouil/fontawesome/blob/7b08fc9bf48b2b0fa7f240b22fc1330d28f6956a/_extensions/fontawesome/fontawesome.lua#L36-L49

cscheid commented 2 years ago

I think we should try to match the FA sizing commands you added to standard latex size commands: \tiny, \scriptsize, \small, \large, etc.

mcanouil commented 2 years ago

Well, this is tricky to match the two.

name pt em-ish
\tiny 5 0.5
\scriptsize 7 0.7
\footnotesize 8 0.8
\small 9 0.9
\normalsize 10 1
\large 12 1.2
\Large 14.4 1.44
\LARGE 17.28 1.728
\huge 20.74 2.074
\Huge 24.88 2.488

what about just adding latex command name as allowed values for pdf?

For reference, FA allows the following for HTML:

mcanouil commented 2 years ago

@cscheid Here a first attempt by simply adding the command names and checking their validity. I also documented these in the example and readme files.

mcanouil commented 2 years ago

I finally implemented new css classes (https://github.com/mcanouil/fontawesome/blob/2d7172af7c6afffb4d50ea91e3f5a295fc30543b/_extensions/fontawesome/assets/css/latex-fontsize.css) to allow to use LaTeX font size commands for both formats with the following font sizes between the two formats.

Sizing Command Font Size (LaTeX) Font Size (HTML)
tiny (= \tiny) 5pt 0.5em
scriptsize (= \scriptsize) 7pt 0.7em
footnotesize (= \footnotesize) 8pt 0.8em
small (= \small) 9pt 0.9em
normalsize (= \normalsize) 10pt (document size) 1em
large (= \large) 12pt 1.25em
Large (= \Large) 14.4pt 1.5em
LARGE (= \LARGE) 17.28pt 1.75em
huge (= \huge) 20.74pt 2em
Huge (= \Huge) 24.88pt 2.5em
cscheid commented 2 years ago

@mcanouil That looks really great, thank you! Looks ready to merge. I'm just going to confirm if we need you to sign a contributor agreement (I'm sorry, I should have brought that up sooner) and I'll get back to you.

mcanouil commented 2 years ago

No worries, I think I (already) signed something like that for https://github.com/rstudio/webshot2/pull/36 (If I recall properly, it was mandatory).

cscheid commented 2 years ago

Ok, I asked around and we don't need it for this case. Thank you much for the contribution! 🚀