4 ms·
These types of text metrics bugs show up in my code over and over and over and over again. I keep making them! When I was working on the icon view in Finder, ic
by diskzero 4y ago
These types of text metrics bugs show up in my code over and over and over and over again. I keep making them! When I was working on the icon view in Finder, icon layout, multi-line icon labels, additional info text and anything else using metrics would constantly be in danger of collapsing. Was this because I was a sloppy coder? Maybe... but the whole stack is so finicky and brittle and filled with some many special cases and different ways of getting layout measured it takes a lot of work to get all of the edge cases covered.
It isn't just Apple of course. I encountered almost the exact same bugs working on Nautilus at Eazel and various projects at Be. And in PowerPlant, and the Think Class Library and MacApp and... the list goes on.
My current music notation project pushed me to try and make multiple font support and layout as robust as possible, but I keep getting burnt! Text layout and metrics is just a difficult area.
- hinoki 4y agoText layout is just hard. There’s a lot of history you need to encode as rules, and you end up with a very complicated system that is hard to abstract because there are circular dependencies all over the place. This bug was because the size of the container depends on the text, whose layout depends on the container. Text just wouldn’t look “right” if we skipped it. It’s as “human” a problem as dates and time, probably worse! Your best bet is to use libraries to avoid the whole problem, but that means delegating all layout which might not be possible.
- ynniv 4y ago"Just use Unix time!" Some problems have a surprising amount of inherent complexity. Java has tried a few times to solve date values, and the results are sometimes unusably complicated. I don't know what the answer is... an even more sophisticated type system? A linting step in the tool chain? An academic paper? An industry publication? Hardware improves every month, but some parts of software worked better thirty years ago.