and yes, lineHeight and letterSpacing is badly needed!
I haven’t read all posts here, but as I produced some fonts myself, I would like to add:
lineHeight might not be a big thing to achieve. Every font delivers its geometry which is read and used by the script. display.newText() seems to read the basic fontHeight of a font, using this as a parameter for lineHeight. This is why the lines in rendered texts are so narrow, it is like lineHeight 1.0 in other applications. It’s not best readable.
It would be a great if the Corona Engineering could at least add this feature: with units of em = multiples of the fontSize or in Corona pixel.
If the Engineering need some more detail information about font techniques, please let me know, maybe I can help.
I just declined a feature request on this since it had been nearly two years with a total of two votes on it. Feel free to create a new feedback item for it, though it would be a better use of your votes to vote on some of the other display.newText() based feature requests.
Yes, we can combine those into a mega request. It’s a lot of votes. But text is a complex thing that can pull our engineers down a rabbit hole that will. I suspect that Perk will have some ideas on what things we should work on next, but we’ve not had time to have those conversations yet.
Personally I don’t think its either “good” or “news”. It’s purely administrative information. I can combine the various requests into one. I haven’t yet, because I need to make sure all of the various items are represented in the mega-request. Also I’m concerned the bigger the task, the harder it will to get the request done.
Please do not read my previous comment as any commitment to any progress on it.
Adjusting line height and character spacing is a critical feature!
My manager has asked me to suggest a 2D platform for mobile development; and I am having to pass on Corona because it won’t be able to deliver even the minimum basic requirements that the design team expects. I am personally a huge fan of Corona, but with modern app development the in-ability to do even the most basic text formatting is crippling.
I’m not sure if this is correct, but I used this to get the spacing between letters in a single line. Probably -1.5 from below is not suitable for other fonts.
local function textWithLetterSpacing(options, space)
space = space*.01 + 1
local j = 0
local text = options.text
local width = 0
for i=1, #text:gsub('[\128-\191]', '') do
local char = text:sub(i+j,i+j+1)
local bytes = {string.byte(char,1,#char)}
if bytes[1]==208 or bytes[1]==209 then -- for russian char
char = text:sub(i+j,i+j+1)
j=j+1
else -- for english char
char = char:sub(1,1)
end
local charLabel = display.newText( mainGroup, char, options.x+width, options.y, options.font, options.fontSize )
charLabel.anchorX=0
width = width + (charLabel.width-1.5)*space
end
end
textWithLetterSpacing({
parent = mainGroup,
text = "Hello world!",
x = 100,
y = 100,
font = "ubuntu_r.ttf",
fontSize = 16*2,
}, 20)