artasparks / glift

Go Lightweight Frontend
MIT License
115 stars 33 forks source link

Change size of 3-digit labels #92

Closed artasparks closed 8 years ago

artasparks commented 9 years ago

Right now, 3-digit-labels overflow the interesections/stones. This isn't ideal, of course, so I should add some logic in to change the size.

yewang commented 9 years ago

In general, SGF allows for arbitrarily long labels, and just changing the text size might not always produce a reasonable output. It might be a bit tricky to get the appropriate size right, since while "111" might fit for some font size, "WWW" (or any full-width CJK characters) might not. I'm not too sure about the best way to compute the actual rendered width of a text string, but that would have to figure into setting the size in order to avoid making all three-character labels very small, just to accommodate a few possibilities that are much wider than average.

For labels longer than 3 characters, it starts to get a bit impractical to just scale down the font size. Another option, suggested by the SGF standard examples, is to truncate longer labels and then use a tooltip to show to the full label.

http://www.red-bean.com/sgf/examples/ http://www.red-bean.com/sgf/examples/ex06.gif

dormerod commented 9 years ago

Related to this issue, I noticed some problems with drawing arbitrary text labels in this Glift lesson: https://gogameguru.com/terrible-tesuji/

In particular, on panel 20 (0.5.0 of this file https://gogameguru.com/i/2015/03/terrible-tesuji.sgf), there are some sad face labels :( and ): on the stones which appear to cause problems for Glift.