Khan / Prototope

Swift library of lightweight interfaces for prototyping, bridged to JS
http://khan.github.io/Prototope
230 stars 18 forks source link

Adding text layers #18

Closed andymatuschak closed 9 years ago

andymatuschak commented 9 years ago

Here’s an API. What do you folks think?

gif of text layer scene

/cc @jbrennan @may-li @nefaurk @nsfmc @saniul

saniul commented 9 years ago

Yep, this is pretty much how I imagined this.

saniul commented 9 years ago

Also, this calls for a text-alignment property.

saniul commented 9 years ago

Suggestion, what if we always set attributedText under the hood, instead of just text? We can also expose an HTML-text setter and use [[NSAttributedString alloc] initWithData... internally. Designers can them provide styled strings using that method.

saniul commented 9 years ago

https://github.com/alexfish/stylize is also relevant

saniul commented 9 years ago

Also, this calls for a text-alignment property.

Implemented in https://github.com/Khan/Prototope/pull/19

andymatuschak commented 9 years ago

Wooo, thanks for making the text alignment pull request! Will take a look at that shortly.

I'd like to wait on exposing fancier styling until we have a better idea of how we'd use it. Would prefer something more structured than HTML (Stylize is a nice reference), but maybe HTML's the easiest/familiar thing. @may-li, @nefaurk, what do you think?

andymatuschak commented 9 years ago

Oh, uh, I totally forgot the ghpages docs. Will do that shortly.

nsfmc commented 9 years ago

my only comment, mostly for docs, is that there should be an easy way to know where the 1st baseline goes for a given textlayer (i.e. is it the layer's y minus the default leading plus the descender?)

saniul commented 9 years ago

@nsfmc I'll do this tonight when I get home

saniul commented 9 years ago

^ https://github.com/Khan/Prototope/pull/24