Code Monkey home page Code Monkey logo

Comments (5)

rmgk avatar rmgk commented on June 30, 2024 1

Hi, as I ran into the same problem, I found a workaround (that does not quite address your use case with inkscape)

Convert the font as you did (well, I used the woff2_decompress debian package but that should not make a difference) and put it somewhere the system finds (I use ~/.local/share/fonts/)
Then add the following to a config file that fontconfig finds (I use ~/.config/fontconfig/conf.d/virgil.conf)
Inkscape seems to still not pick it up, but conversion to PDF via cairosvg does work, and inkscape can then import that pdf corectly …

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>

  <match target="pattern">
    <test name="family" qual="any" >
      <string>Virgil</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Virgil 3 YOFF</string>
    </edit>
  </match>

</fontconfig>

from virgil.

suuuehgi avatar suuuehgi commented on June 30, 2024 1

Same here. There are multiple problems here.

  1. Excalidraw exports SVGs using a font Virgil but the provided font calls itself Virgil 3 YOFF.
  2. I Installed the provided Virgil font Virgil 3 YOFF but fc-match refused to find it. -> Inkscape fails to render it properly.
  3. For emojis, Excalidraw uses Segoe UI Emoji what is a proprietary Microsoft font not present on non-MS systems (an open-source alternative is Noto Color Emoji).
    2.2) Apparently, Inkscape -- at least on Linux -- is not capable of rendering text-emojis at all.

So, it all depends on what one wants to do with the file.

  • If you want to use it in Inkscape with editable text, you can do a simple text replacement (Virgil -> Virgil 3 YOFF) within the SVG file. Then it renders correctly within Inkscape for me. With emojis you appear to be out of luck here.
  • If you want to just get a vector graphic, Firefox renders the SVG fine (in fact, browsers are the only programs I tried that do render this correctly). From your Browser, you can print it as PDF. As this is most likely not the correct size (a4 or letter), you can cut it with your program of choice (e.g. briss, inkscape, ... [for Inkscape you have to choose "Poppler/Cairo import" to convert the text to paths]). It's a hassle but at least now I have my EPS file.

from virgil.

RaphaelWimmer avatar RaphaelWimmer commented on June 30, 2024

Another workaround (on Debian / Linux): open the ttf file generated by woff2_decompress with fontforge and select Element -> Font Info.. from the menu. Replace font name with "Virgil" and generate a new ttf file via File -> Generate Fonts....

image

image

from virgil.

ubitux avatar ubitux commented on June 30, 2024

Hi, as I ran into the same problem, I found a workaround (that does not quite address your use case with inkscape)

Convert the font as you did (well, I used the woff2_decompress debian package but that should not make a difference) and put it somewhere the system finds (I use ~/.local/share/fonts/)

I confirm that it needs to be in something else than .woff2 for Inkscape to accept the font: even though fc-match 'Virgil 3 YOFF' does return Virgil.woff2: "Virgil 3 YOFF" "Regular" we can't use it in Inkscape.

Then add the following to a config file that fontconfig finds (I use ~/.config/fontconfig/conf.d/virgil.conf)

Note here: it seems that I needed the config file to be prefixed by a number to be honored:

% cd ~/.config/fontconfig/conf.d
% ls
virgil.conf
% sudo -E strace -u $USER -f -e openat fc-match Virgil|& grep virgil.conf
% mv virgil.conf 01-virgil.conf
% sudo -E strace -u $USER -f -e openat fc-match Virgil|& grep virgil.conf
openat(AT_FDCWD, "/home/ux/.config/fontconfig/conf.d/01-virgil.conf", O_RDONLY|O_CLOEXEC) = 5

Also, it's interesting that fc-match Virgil doesn't indeed match Virgil 3 YOFF by default and we need that configuration.

Inkscape seems to still not pick it up, but conversion to PDF via cairosvg does work, and inkscape can then import that pdf corectly …

The excalidraw SVG contains this: font-family="Virgil, Segoe UI Emoji", and the emoji fallback is the problematic one. Here is how it behaves with fontconfig on my machine:

% fc-match "Virgil"
Virgil.ttf: "Virgil 3 YOFF" "Regular"
% fc-match "Virgil, Segoe UI Emoji"
NotoColorEmoji.ttf: "Noto Color Emoji" "Regular"

If I do uninstall noto emoji though:

% fc-match "Virgil, Segoe UI Emoji"
Virgil.ttf: "Virgil 3 YOFF" "Regular"

And finally here it works for me in Inkscape. Alternatively, removing the Segoe references in the Excalidraw SVG also works. Note that whether you specify Virgil before or after Segoe UI Emoji doesn't help with the priority selection. Also, even specifying explicitly Virgil 3 YOFF doesn't help (so this is not an issue with the fontconfig file you proposed).

To summarize, here is a summary of the multiple issues we have:

  • Inkscape: missing external and embedded font support: https://gitlab.com/inkscape/inbox/-/issues/301
  • Inkscape: could add support for woff2 format
  • Inkscape: I think Inkscape should not pass-through the font-family as-is to fontconfig and instead query one by one depending on the characters requested (or maybe fontconfig should honor the order but since it doesn't know the characters in fc-match I think it makes sense to use another heuristic, but I don't know)
  • Fontconfig: honestly, Virgil should match Virgil 3 YOFF, I don't know why it needs the exact string here
  • Excalidraw: should probably embed the font so we don't have to download it
  • Excalidraw: the Virgil 3 YOFF should be named Virgil to avoid that kind of nasty matching issues

from virgil.

aarav2you avatar aarav2you commented on June 30, 2024

For people who want PDFs:
After you get your SVG with the font working:

  1. Open it in your browser (I used a chromium based one)
  2. Press Ctrl+P
  3. If not fitting properly:
    a. Go to More Settings
    b. Changer paper size to A0
    c. Remove margins
    d. Decrease scale value till it fits
  4. Save as PDF
  5. Later you can resize the PDF using other tools

Proof this works:
image

from virgil.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.