-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d9bdc90
commit 2145e8b
Showing
1 changed file
with
3 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2145e8b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One possible idea?
fontSize Local
transforms with scales and all.The other measures have their transforms normalized by the
avgScale
, so for examplea
scaleX 2
, would bescaleX 2 . scale 1/(sqrt 2)
.2145e8b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha! Yes, I think this is a good way to do it.
Oh, one minor snag: if the text is not centered then scaling it is going to cause the text to move closer to the local origin in addition to being scaled. I would have to try some examples but I think this is a problem. To solve it we would have to do something like store a separate affine transformation and translation vector, and decompose incoming transformations into those components as well, only applying the inverse of the avgScale to the affine part.
2145e8b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have enough control over alignment to test it in SVG or do we need to implement units in Cairo or Rasterific?
2145e8b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not about alignment. Just translate some text, like
text "foo" # translateX 5
.2145e8b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll run some tests tonight.
2145e8b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've played around with this a bit and I'm not sure whether or not this is a problem.
Part of the problem is that I'm not sure of what semantics something like:
should have.
Can you take a look at the diagram this generates and tell me how the desired diagram should look?
2145e8b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I played around with it and it seems to have exactly the semantics I expect: namely, the location of the text is affected normally by any transformations; it's just the text itself which is prevented from scaling. This puzzled me until I looked at the code again and realized I had not properly understood the cleverness of writing
(t <> tt <> t')
: first we undo any effects oft
's scaling; then we do any existing transformationstt
(which might include translations), and finally we do the new transformationt
! So when we dosomeText # transform t1 # transform t2 # transform t3
we ultimately end up with the transformationt3 <> t2 <> t1 <> t1' <> t2' <> t3'
where the primed versions are all uniform scalings counteracting theavgScale
of the other three. Since they happen first they don't affect any translations contained int1 .. t3
.So, to be clear, I am quite happy with this code!
2145e8b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent, so all that remains is to decide on what
Measure
to use as a default.