chaoticbob / Cinder-SdfText

libcinder.org
SIL Open Font License 1.1
40 stars 20 forks source link

Alignment #10

Closed paulhoux closed 8 years ago

paulhoux commented 8 years ago

Includes Left, Center, Right and Justify alignment. See individual commits for more info.

paulhoux commented 8 years ago

One thing to note is that the way I detect if we're at the last line is incorrect. It looks at the last line of the text as a whole, not of the paragraph. I tried changing the algorithm to "only if line covers at least 75% of the width", but this is too arbitrary. I am afraid we can't avoid looking at the next line for real.

paulhoux commented 8 years ago

Ok, I think I have a solution: pre-fetch the next line of text in a way that doesn't require us to trim and convert to UTF32 twice.

With that being said, and BEFORE you merge(!) : maybe we should just use a bool justify = true/false, instead of making it an option like Left, Center and Right are. Reason being: you want to control the alignment of the last line of each paragraph separately. With justify=true, all lines are justified except the last one, which will use either left, right or center. Agree?

chaoticbob commented 8 years ago

Where are you thinking for justify? Would the justify be on the drawstring parameters?