To be absolutely sure, i'd go over either the 26 basic latin letters and compare all to the first, for example; or if possible, i'd check for the ones the user(s) actually used.
Then again, instead of rejecting non-monospaced fonts, you could still do the route i mentioned above, even if it would be a tad more wasteful... or you could use a canvas; depending on a few things, with that, even non-monospaced symbol placement can be "optimized". (Only drawing everything once / when a symbol changes in a specific location; at all other times, you'd just have one draw call to draw the whole canvas... and this would also be useable with monospaced fonts as well.)
Get widest character of font?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Get widest character of font?
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
- TheOddByte
- Prole
- Posts: 35
- Joined: Sun Dec 15, 2013 7:15 pm
Re: Get widest character of font?
How would I do this with a canvas? I'm not very familiar with that.
By the way, here's the code I'm currently using: http://pastebin.com/sEzk7SWx
As you can see I'm currently drawing each character individually, which I realize isn't very optimal.
What's the object-oriented way to get wealthy? Inheritance.
- Positive07
- Party member
- Posts: 1014
- Joined: Sun Aug 12, 2012 4:34 pm
- Location: Argentina
Re: Get widest character of font?
Non monospaced fonts will probably look horrible in a grid... The shorter solution should be enough to detect if it's monospaced
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
Who is online
Users browsing this forum: Ahrefs [Bot] and 5 guests