Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

text does not scale #179

Closed
byorgey opened this issue Apr 24, 2014 · 7 comments · Fixed by #182
Closed

text does not scale #179

byorgey opened this issue Apr 24, 2014 · 7 comments · Fixed by #182
Assignees

Comments

@byorgey
Copy link
Member

byorgey commented Apr 24, 2014

f = text "F" <> square 1 # lw none

main = defaultMain (f ||| f # scale 2)

produces

textscale

However, since font size is measured in Local units by default, I would expect the F on the right to be twice as big.

@jeffreyrosenbluth
Copy link
Member

hmm, The default does not seem to be setting properly.
When I change to

f = text "F" # fontSizeL 1 <> square 1

it renders correctly

@byorgey
Copy link
Member Author

byorgey commented Apr 24, 2014

Curiouser and curiouser.

@byorgey
Copy link
Member Author

byorgey commented Apr 24, 2014

Oh, I know why. It's because we tried to handle this by making font size a transformable attribute. So when you do text "F" # fontSizeL 1 # scale 2, the transformation has an effect on the font size attribute. However, in the default case, a font size attribute gets added to the diagram at the very end, where it is definitely not affected by any transformations.

@byorgey
Copy link
Member Author

byorgey commented Apr 24, 2014

I think having font size be transformable is the wrong way to do this. A potential solution is to (1) make font size not transformable again; (2) add a Double field to Text, storing the average scale applied to it; (3) use that field when rendering to apply some extra scaling, IF the current font size attribute in effect is Local... Note, however, that everything will have been converted to Output by then, so we would have to store an extra Bool in every FontSize attribute, saying whether it began its life as Local.

Actually, this requires a bit more careful thought... we had to be clever about doing the anti-scaling in the right way. Maybe instead of storing the anti-scaled T2 plus a Double for the average scaling, we should just store two T2 values: one intact, and one anti-scaled as now. Then rendering can just pick which one to use based on whether the font size is Local.

@byorgey
Copy link
Member Author

byorgey commented Apr 24, 2014

I think I can easily fix this; however, I will also try to write up a summary of the issues of semantics on the wiki, as IRC discussion has shown this is far from settled.

@byorgey byorgey self-assigned this Apr 24, 2014
@jeffreyrosenbluth
Copy link
Member

There also seems to be a separate (could be related) problem, the SVG backend does not seem to render text with Local fontsize at all.

@byorgey
Copy link
Member Author

byorgey commented Apr 24, 2014

Interesting. I'll take a look at that too.

byorgey added a commit that referenced this issue May 2, 2014
Fixes #179.  This patch is very much along the lines outlined in
comments on the ticket.  There will be accompanying patches to backends.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants