asciidoctor / docker-asciidoctor

:ship: A Docker image for using the Asciidoctor toolchain to process AsciiDoc content
https://hub.docker.com/r/asciidoctor/docker-asciidoctor/
Other
324 stars 149 forks source link

asciidoctor-mathematical Missing fonts #55

Closed philwinder closed 6 years ago

philwinder commented 7 years ago

Hi, thanks for this docker image.

It appears that some fonts are missing from the image.

Using the following asciidoc:

= Precompiled Math
:math:
:imagesoutdir: generated_images
:imagesdir: images
:stem: latexmath

== Equations in normal blocks

[latexmath]
++++
k_{n+1} = n^2 + k_n^2 - k_{n-1}
++++

Some useful text! Formula for quadratic root:

[latexmath]
++++
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
++++

Then run the command (inside the running container):

asciidoctor-pdf -r asciidoctor-mathematical -o test.pdf test.adoc

The pdf renders the sqrt symbol incorrectly. (Similar to this issue: https://github.com/gjtorikian/mathematical/issues/79)

Are the fonts included ok?

screen shot 2017-11-07 at 12 49 48

Update:

I've just found a docker container that works: rochdev/alpine-asciidoctor:plus

dduportal commented 6 years ago

Hello @philwinder!

Thanks for taking care of filling this report with a complete use case. I got exactly the same thing here, so trying to reproduce.

The first pick is that some fonts might been removed with #39 (moving to alpine linux OS base). We'll give you some news as soon as we have things.

dduportal commented 6 years ago

So here is a quick fix I did manually. I will work to put it on the image (and/or find a better solution).

It comes from the documents you linked: https://github.com/gjtorikian/mathematical#fonts-and-special-notices-for-mac-os-x

# From inside the Docker container
mkdir -p /usr/share/fonts/bakoma
cd /usr/share/fonts/bakoma
curl -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmex10.ttf \
     -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmmi10.ttf \
     -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmr10.ttf \
     -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmsy10.ttf \
     -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/esint10.ttf \
     -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/eufm10.ttf \
     -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/msam10.ttf \
     -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/msbm10.ttf
cd /documents
asciidoctor-pdf -r asciidoctor-mathematical -o test.pdf test.adoc

Ping @jirutka @mojavelinux @mgreau , do you have any knowledge about fonts and/or fonts in Alpine that could help here? I don't have any :)

mgreau commented 6 years ago

@dduportal sorry I don't have any knowledge about fonts and/or fonts in Alpine

jirutka commented 6 years ago

What fonts do you need - only those in the above snippet? I'll create a package for them.

dduportal commented 6 years ago

Thanks for you answers @mgreau @jirutka!

@jirutka , based on the mathematical repository, it seems those fonts are OK on OS X, to have a correct rendering of such an issue.

Also, those fonts are rendering correctly some LateX things: might be a good idea to package them then :) Thanks!

jirutka commented 6 years ago

I’ve created package font-bakoma. It’ll arrive to the testing repo in few hours. You can install it using e.g.:

apk add --no-cache --repository https://nl.alpinelinux.org/alpine/edge/testing font-bakoma-ttf

(or font-bakoma-otf for OpenType fonts)

Let me know if it helped, I’ll move it to the community repository.

dduportal commented 6 years ago

Thanks @jirukta, you rocks!

The font is not available right now, but as you said, we'll wai a few hours :)

jirutka commented 6 years ago

It will take longer because builders are now busy rebuilding pkgs after LibreSSL update. :(

dduportal commented 6 years ago

No problem @jirutka , we'll wait. thanks for keeping us informed.

jirutka commented 6 years ago

font-bakoma packages are finally on mirrors.

dduportal commented 6 years ago

Hello @philwinder, a Pull request has been opened with a fix for this: #56 .

Can you check it (a prebuilt image is available to let you test) and confirm the fix is working for your case?

I took the liberty to reuse the code snippet you provided here to have a test case (the test case is not perfect: It would need to have an image analysis capability, but A first level of testing is here).

dduportal commented 6 years ago

Hello! I am closing this issue since we did not had feedbacks from @philwinder .

The main Docker image (with the tag latest) had been built with the change from #56 , which seems to fix the mathematical rendering by adding the right fonts. Build on the DocerHub: https://hub.docker.com/r/asciidoctor/docker-asciidoctor/builds/bpxcqaqciueea2dahka9cep/

@philwinder , Please, feel free to re-open this issue or create a new one if it is not answering your use case, or if you are not happy with the outcomes of those changes. Thank you for taking time to write down the issue and documenting it!

adamryczkowski commented 1 year ago

On Ubuntu 22.04 one can fix this issue by installing sudo apt install fonts-lyx

mojavelinux commented 1 year ago

Thanks for pointing that out. I'll add that this package is listed in the asciidoctor-mathematical readme. See https://github.com/asciidoctor/asciidoctor-mathematical/#ubuntu