adobe-research / svgObjectModelGenerator

SVG OM Generator & Writer
Apache License 2.0
49 stars 20 forks source link

[3841453] Layer FX: Text gets offset/clipped if there are layer fx added. #72

Open joebowden opened 10 years ago

joebowden commented 10 years ago

Test file: http://adobe.ly/1nP7VtN

  1. Open test file in PSD
  2. Open layers in crema, or generate svg
  3. Examine preview/svg files

Result: Text is offset or clipped when there are layer fx. Bevel & emboss doesn't render at all (for shapes, it renders without the fx).

jhatwich commented 10 years ago

The bevel & emboss was an encoding bug that I'm fixing - something is off between the text bounds and the way they relate to bounds with FX. we are relying on EM positioning for Y and it isn't holding up with effects or maybe we are just calculating the font-size wrong? @dirkschulze if you can see maybe fresh eyes will help.

dirkschulze commented 10 years ago

I am currently sharing my screen at a conference. I try my best to look at some of the things during pauses.

dirkschulze commented 10 years ago

Ok, we have the text property which has the bounds property. This usually is far too big. But for fx effects we don't seem to get the right boundaries otherwise. Therefore I suggest using this box.

dirkschulze commented 10 years ago

Argh, I totally missed it. So, bonds are not correct for text layers in PS. I don't know why yet. However, that is the reason why we use other bounds. This usually works if you don't apply FX effects. If you have fx effects though, we do not use the computed text bounds but fall back to the fx bounds instead. Which are also wrong:

svgWriterProcessor.js

        if (omIn.boundsWithFX) {
            bndsIn = omIn.boundsWithFX;

        } else {

We probably need to check textBounds and fx bounds and either take the bigger area, or even better take the union of both.

jhatwich commented 10 years ago

I was able to figure out a bounds diffing scheme that seems to fix most of the cases we have... the ones that are not right are not too far off at least. I think there are bugs in the generator bounds, but I have not isolated them. Could be that we just need more info to know where the text is within the bounds they provide.

jhatwich commented 10 years ago

Setting this to "testing" so that Joe can have a look. Its not going to be fixed/closed but it might not be as high priority now.

dirkschulze commented 10 years ago

The bounds are most definitely wrong. If I have a font size of 48px the bounds can not be 30px height. We have to talk with Generator and PS about that.

joebowden commented 10 years ago

@jhatwich It's definitely better than it was. It's still off a bit in places, especially with characters with ligatures that run below the baseline. We're not at parity with extract or jsx, but if there's no time to get the rest of it fixed, we can live with it.

Of course if we can get another fix in the time we have, I'll take it. :)

joebowden commented 10 years ago

In the test file, all looks good in Crema preview. But when you generate svg, most layers show clipping on the right side - some just a bit, and a few show quite a bit of clipping. Removing testing label.

joebowden commented 10 years ago

https://watsonexp.corp.adobe.com//#bug=3841453