Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Texts in converted svg files not selectable #50

Closed
xuhdev opened this issue Dec 29, 2015 · 4 comments
Closed

Texts in converted svg files not selectable #50

xuhdev opened this issue Dec 29, 2015 · 4 comments
Assignees
Labels

Comments

@xuhdev
Copy link

xuhdev commented Dec 29, 2015

test.tex: the following LaTeX source code:

\documentclass{article}

\pagestyle{empty}

\begin{document}
Hi this is some texts.
\end{document}

Generate the dvi file:

latex test.tex

Convert it to svg:

dvisvgm -n test.tex

Open the file in a web browser, I found the texts are not selectable. However, if I converted it with inkscape (dvi-->pdf-->svg path), the texts are selectable.

@mgieseki
Copy link
Owner

If you call dvisvgm without option -n, you get an SVG file with font and text elements rather than graphics paths. The text of these files is usually selectable in the browser or SVG viewer. However, most web browsers don't support font elements so that the result looks wrong.

I don't quite understand how you convert the files to SVG using Inkscape. Do you call pdflatex and then use Inkscape's function File > Import? What additional options do you select in the import dialog?

@mgieseki mgieseki self-assigned this Dec 29, 2015
@xuhdev
Copy link
Author

xuhdev commented Dec 29, 2015

@mgieseki I made the conversion using the following steps:

pdflatex test.tex
pdfcrop test.pdf
inkscape -z test-crop.pdf --export-plain-svg=test.svg

I can understand your point, but I still don't know why inkscape works...

@xuhdev
Copy link
Author

xuhdev commented Dec 29, 2015

I see that inkscape does not convert some complicated texts well, which should be the same as dvisvgm without -n option. Thanks for your reply.

@xuhdev xuhdev closed this as completed Dec 29, 2015
@mgieseki
Copy link
Owner

Thanks for the additional info.
Inkscape doesn't embed the glyph data into the SVG file but references external font files. So the browser loads the font file and takes the glyphs from there. Unfortunately, this doesn't work in all cases. There are TeX fonts containing glyphs that are not reachable by Unicode, e.g. big integral or sum signs (also see this question at TeX.SX). I'm already looking for a way to find a solution for this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants