Skip to content

changing fontStyle func to set all font attr and adding fontWeight func to set just font weight attr #394

Closed

Description

@studioijeoma

I think fontStyle should set all the font attributes in 1 line like css's font property and while a new function named fontWeight should set the font's weight.

Activity

  1. changed the title [-]changing fontStyle to set all font attr and a new fontWeight to set just font weight attr[/-] [+]changing fontStyle func to set all font attr and adding fontWeight func to set just font weight attr[/+] on Oct 15, 2014
  2. lmccart commented on Sep 29, 2015

    @lmccart
    Member

    I'm not sure what this means exactly. I don't believe there is a fontStyle() function currently?

  3. dhowe commented on Sep 30, 2015

    @dhowe
    Contributor

    textStyle() ?

  4. lmccart commented on Oct 4, 2015

    @lmccart
    Member

    ah that must be it. there are no other comments on this so it seems not crucial enough to warrant deviating from the processing API. @dhowe what do you think, ok to close?

  5. studioijeoma commented on Oct 5, 2015

    @studioijeoma
    Author

    I really cant remember what problems I was running into when I thought of it this. I think I meant it'd be good to be able to set the font, size, weight, and style in one call/func like in css with font property

  6. dhowe commented on Oct 5, 2015

    @dhowe
    Contributor

    If we can clearly document this, it seems like a useful (additional) option at least for browser/system fonts, and we wouldn't have to change the API... @ekeneijeoma, maybe you can add a quick sketch to the examples/p5.Font dir to show a few examples of how it might work?

  7. brysonian commented on Oct 5, 2015

    @brysonian
    Contributor

    i'm not sure supporting all the variations of the css font property is necessary, perhaps for one-line-ness, chaining would be a more javascripty way to do it? textFont(foo).textStyle(BOLD).textSize(40)

    Also being able to set the weight with numbers rather than just BOLD and NORMAL might be useful.

  8. dhowe commented on Oct 5, 2015

    @dhowe
    Contributor

    I guess the intent here is something like below?

    textStyle('italic bold 12px/30px Georgia, serif');
    textStyle('italic 2em "Open Sans", sans-serif');
    textStyle('italic small-caps bolder 16px/3 cursive');
    
  9. studioijeoma commented on Oct 7, 2015

    @studioijeoma
    Author

    I just found myself having to change the font and weight for a project with heavy text layout a lot and thought it'd be great if I could do it in 1 line. @dhowe I was thinking something more like textStyle(FONT,WEIGHT,SIZE) where the weights are numbers with constants (LIGHT, BOLD, and etc). I think it should only use params that are already in the api.

  10. studioijeoma commented on Oct 7, 2015

    @studioijeoma
    Author

    Also as far as I know a lot of those params/styles are only used in HTML ex: em, px/px, small-caps, and cursive.

  11. lmccart commented on Oct 12, 2015

    @lmccart
    Member

    I think this is easy enough to do manually using the underlying canvas api, I suggest we don't further bloat the API as there are already a lot of settings to keep track of. for example:

    function setup() {
      createCanvas(200, 200);
      drawingContext.font = 'italic small-caps bold 12px arial';
      text('testing testing', 50, 50);
    }
  12. studioijeoma commented on Oct 12, 2015

    @studioijeoma
    Author

    That works great for canvas but then what about WebGL? The problem is still
    the same.

  13. lmccart commented on Oct 12, 2015

    @lmccart
    Member

    in webgl, couldn't you just use a canvas to create a texture that has text in it?

  14. lmccart commented on Oct 12, 2015

    @lmccart
    Member

    ah, I didn't realize processing does support 3d text. I don't think p5.js does currently (except for the 2d canvas solution) but I suppose eventually it should. in any case, I'd really prefer to flesh out the existing API and fix type related bugs before adding more possible cases. so unless someone is volunteering to implement this right now, I'd suggest we close it for now and revisit at some future point. sound ok?

  15. dhowe commented on Oct 12, 2015

    @dhowe
    Contributor

    sounds good to me
    note: 3d text is another case where path-points for fonts comes in handy...

  16. studioijeoma commented on Oct 12, 2015

    @studioijeoma
    Author

    @dhowe right! you could also use divs which are usually better for labeling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions