Jump to content

twise

Members
  • Posts

    5
  • Joined

  • Last visited

  1. Hi, There appears to be a bug in the SVG import process, specifically when using clones and applying scaling & translations. I noticed this following a change in how Matplotlib in Python exports SVGs - since this change, text characters end up on top of one another rather than being spaced apart when imported into AD. There are no problems importing into Inkscape, Chrome, etc. Here is a minimal example, with a lowercase L followed by a dash (the SVG file to recreate this is attached). This is how it (correctly) appears when imported into Inkscape. And this is how it appears imported into AD. The problem seems to lie in the application of x/y positioning to clones when importing into AD. When the paths themselves are scaled (in this example by 0.015625), the X offset is applied before the scaling rather than after, meaning the X offset of the characters is 0.015625 times what it should be. Everything is fine if the "x" value is replaced by an equivalent translation. # This doesn't work <use x="27.783203" xlink:href="#DejaVuSans-45"/> # This works, replacing the "x" argument with a translation <use transform="translate(27.783203 0)" xlink:href="#DejaVuSans-45"/> More discussion related to this issue can be found in this thread. Thanks!
  2. Thanks all for your help! I'll report it as a bug.
  3. That's great, thank you! Yes, it seems like it's the use of x and y in the <use> part that Affinity doesn't handle well, but apparently it's fine if it's provided as a translation instead. It definitely seems that this is a minor issue with AD's SVG imports given other software handles it without any problems, but at least it might be possible to work around it.
  4. Sure, here's my minimal example which is a lowercase L followed by a dash (should come out as l-). This is correct, as it appears imported into Inkscape: And this is incorrect, as it appears imported into AD: This is the most minimal example I could come up with, but the same happens with more characters - they all end up on top of one another instead of next to each other.
  5. Hi, I've recently noticed that SVG files exported from Matplotlib in Python are no long imported into Affinity Designer correctly, following a change in how Matplotlib exports SVGs. Essentially characters within text end up on top of one another rather than being spaced apart. There are no problems importing into Inkscape, Chrome, etc. suggesting the problem lies with AD. I've pinned down the problem to how AD parses X and Y positions in SVG <use> tags - these seem to be applied before path transforms rather than after. The Matplotlib export process multiplies the <path> specification values for each text character by 64 (this makes the values integers, so the file size is smaller), then uses transform="scale(0.015625)" (1/64) to ensure they are the correct size. The placing of characters in the text field is then controlled by X and Y offsets in <use> tags. These X and Y values are not *64 like the path values, as ordinarily they are applied after the 1/64 scaling. However in AD the offsets are applied prior to transforming, resulting in them being 1/64 what they should be. I've attached a basic example exported SVG that doesn't import correctly into AD. svg_example.svg
×
×
  • Create New...

Important Information

Please note there is currently a delay in replying to some post. See pinned thread in the Questions forum. These are the Terms of Use you will be asked to agree to if you join the forum. | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.