Giter Site home page Giter Site logo

Styling Issue about resvg-test-suite HOT 9 CLOSED

razrfalcon avatar razrfalcon commented on May 26, 2024
Styling Issue

from resvg-test-suite.

Comments (9)

RazrFalcon avatar RazrFalcon commented on May 26, 2024

I don't think any app except browsers does support @font-face. So this will not be universal anyway.

To get the expected results, you have to simply install those fonts. That's it.

from resvg-test-suite.

paulushub avatar paulushub commented on May 26, 2024

I don't think any app except browsers does support @font-face. So this will not be universal anyway.

Below is the result for Batik 1.14, I think most libraries with complete CSS support implement @font-face. Installation does not map for generic fonts like serif, monospace etc.

Without Styling (current default) With Styling (above css embedded)

from resvg-test-suite.

RazrFalcon avatar RazrFalcon commented on May 26, 2024

Are you sure? I've just tested this file:

<svg id="svg1" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
    <title>Simple case</title>

    <style>
        .fantasy {
            font-family: "Sedgwick Ave Display", fantasy;
        }
        @font-face {
            font-family: "Sedgwick Ave Display";
            font-style: normal;
            font-weight: 400;
            src: url(../fonts/SedgwickAveDisplay-Regular.ttf) format('truetype');
         }
    </style>

    <path id="crosshair" d="M 20 100 L 180 100 M 100 20 L 100 180"
          stroke="gray" stroke-width="0.5"/>

    <text id="text1" x="32" y="100" font-family="fantasy" font-size="64">Text</text>

    <!-- image frame -->
    <rect id="frame" x="1" y="1" width="198" height="198" fill="none" stroke="black"/>
</svg>

And all applications, even browsers, ignored it.

from resvg-test-suite.

RazrFalcon avatar RazrFalcon commented on May 26, 2024

Installation does not map for generic fonts like serif, monospace etc.

Yes, you just have to check those tests manually. Testing cannot be automated anyway.

from resvg-test-suite.

paulushub avatar paulushub commented on May 26, 2024

And all applications, even browsers, ignored it.

True, however, the issue here requires a bit more investigation.
I used a different fantasy font, Old English Text MT (installed on my system) and it does not work in any browser and even in the Resvg (if you do not specify the --fantasy-family on the commandline).

<svg id="svg1" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
    <title>Simple case</title>

    <style>
		.fantasy {
			font-family: "Old English Text MT", fantasy;
		}
    </style>

    <path id="crosshair" d="M 20 100 L 180 100 M 100 20 L 100 180"
          stroke="gray" stroke-width="0.5"/>

    <text id="text1" x="32" y="100" font-family="fantasy" font-size="48">Text</text>

    <!-- image frame -->
    <rect id="frame" x="1" y="1" width="198" height="198" fill="none" stroke="black"/>
</svg>

I also tried Papyrus for the fantasy font and it fails!
For Resvg, even setting Papyrus directly fails, but works in all browsers.

<svg id="svg1" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
    <title>Simple case</title>

    <path id="crosshair" d="M 20 100 L 180 100 M 100 20 L 100 180"
          stroke="gray" stroke-width="0.5"/>

    <text id="text1" x="32" y="100" font-family="Papyrus" font-size="48">Text</text>

    <!-- image frame -->
    <rect id="frame" x="1" y="1" width="198" height="198" fill="none" stroke="black"/>
</svg>

from resvg-test-suite.

RazrFalcon avatar RazrFalcon commented on May 26, 2024

Fonts testing is basically manual at this point. I simply checking that results are somewhat correct.
For example, if I set font-family to monospace, I don't care what font an app would choose, as long as it's monospace. I don't expect all apps to resolve the same font.

from resvg-test-suite.

paulushub avatar paulushub commented on May 26, 2024

@RazrFalcon I understand your point. As I stated earlier, I was trying to see if we can get a consistent results through a CSS definition (after seeing the results from Inkscape, the first sample).
However, the current results I am getting is that Resvg does not seem to support font-family installed on the system. Can you confirm this? I tried many and none is working for the sample above.

from resvg-test-suite.

RazrFalcon avatar RazrFalcon commented on May 26, 2024

resvg does support system fonts. It doesn't support @font-face from CSS.

from resvg-test-suite.

RazrFalcon avatar RazrFalcon commented on May 26, 2024

Sadly, an SVG test suite has to be tailored to the lowest common denominator. Which means no CSS.
For example, librsvg doesn't allow external images at all. So we have to bloat our tests with base64 encoded one.

from resvg-test-suite.

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.