3 ms·
I help maintain/develop an app that allows users to draw and simulate logic circuits on a canvas. Text plays a minor but important role for labeling various com
by kevhito 10y ago
I help maintain/develop an app that allows users to draw and simulate logic circuits on a canvas. Text plays a minor but important role for labeling various components, showing bit and hex values, etc. The app uses system fonts, and it's a huge mistake. The sizes and exact layout and connectivity of various logic blocks depends on text size, and when that changes (and it does from platform to platform), it leads to lots of subtle and hard to notice errors. I've spent a lot of time tracking down every logic dependence on character width and making those all platform-independent heuristics instead of using the actual font metrics. Which makes the UI often look terrible (but at least it is a consistent and functionally correct terrible). I would much rather the app bundle a freely redistributable font and be done with it.
- junke 10y agoI don't know what toolkit you are using, but when I want to place text with e.g. SDL_ttf, I can compute the width and height of a string knowing its font. IMO relying on a specific font is exactly like throwing magic numbers in a codebase. I can understand that it simplifies things, but it doesn't feel right.
- userbinator 10y agoThe sizes and exact layout and connectivity of various logic blocks depends on text size I have used many schematic editors and they all handle different font sizes correctly, even letting you choose different fonts and styles within the same document. It is not difficult to figure out how much space a piece of text takes up, and scale the other elements to fit. If the actual connectivity of the parts in your schematic changes with font size, then I will quite frankly say "you're doing it wrong".
- yoz-y 10y agoIt seems to me that having a specific UI toolkit font would not help you in your case. If Go maintainers decide to change the font metrics you will have the same problem. Distributing your own font (as you have mentioned) is the right way to go.
- sp332 10y agoIf the Go maintainers change metrics, you can still distribute the old version, or even modify the new version back to the metrics you want and distribute the result. That's the advantage to friendly licensing.