Different font versions (light, ultrabold etc.) other than italic/bold don't show in Processing?

I'm about ready to file this as a bug, but just to be sure; anyone else trouble getting certain font styles to work in Processing? I seem to have invariably trouble getting Light variants of fonts to work, and whether condensed works seems arbitrary.. Tested both the behaviour of createFont and loadFont, but they seem the same.

See test sketch below:

PFont light, lightItalic, normal, normalItalic, bold, boldItalic, black; 

void setup()
{
  size(800, 800);
  //println(PFont.list());

  //normal = createFont("Helvetica", 100);
  //light = createFont("Helvetica-Light", 100);
  //bold = createFont("Helvetica-Bold", 100);

  light         = createFont("GillSans-Light", 100);
  lightItalic   = createFont("GillSans-LightItalic", 100);
  normal        = createFont("GillSans", 100);
  normalItalic  = createFont("GillSans-Italic", 100);
  bold          = createFont("GillSans-Bold", 100);
  boldItalic    = createFont("GillSans-BoldItalic", 100);
  black         = createFont("GillSans-UltraBold", 100);
  
}


void draw()
{
  textAlign(CENTER, CENTER);
  int numLines = 8;

  textFont(light);
  text("PROCESSING", width/2, height/numLines*1);
  textFont(lightItalic);
  text("PROCESSING", width/2, height/numLines*2);
  textFont(normal);
  text("PROCESSING", width/2, height/numLines*3);
  textFont(normalItalic);
  text("PROCESSING", width/2, height/numLines*4);
  textFont(bold);
  text("PROCESSING", width/2, height/numLines*5);
  textFont(boldItalic);
  text("PROCESSING", width/2, height/numLines*6);
  textFont(black);
  text("PROCESSING", width/2, height/numLines*7);
}

Answers

  • Jesus christ, how do you get code to format properly?!

  • OK, no-one?

  • edited April 2015

    We are still waiting for a readable code... :-) Edit your message and reformat it, please.

  • Haha fair enough, here you go. Knock yourself out with this amazingly formatted code ;)

  • Anyway, I tried a variant of your sketch, on Windows 7, with another font:

    PFont normal, normalItalic, bold, boldItalic; 
    
    void setup()
    {
      size(800, 800);
      println(join(PFont.list(), "\n"));
    
      //*
      normal        = createFont("QuicksandBook-Regular", 100);
      normalItalic  = createFont("QuicksandBookOblique-Regular", 100);
      bold          = createFont("QuicksandBold-Regular", 100);
      boldItalic    = createFont("QuicksandBoldOblique-Regular", 100);
      //*/
      /*
      normal        = createFont("Quicksand Book", 100);
      normalItalic  = createFont("Quicksand Book Oblique", 100);
      bold          = createFont("Quicksand Bold", 100);
      boldItalic    = createFont("Quicksand Bold Oblique", 100);
      //*/
    //  exit();
    }
    
    
    void draw()
    {
      textAlign(CENTER, CENTER);
      int numLines = 8;
    
      textFont(normal);
      text("PROCESSING", width/2, height/numLines*3);
      textFont(normalItalic);
      text("PROCESSING", width/2, height/numLines*4);
      textFont(bold);
      text("PROCESSING", width/2, height/numLines*5);
      textFont(boldItalic);
      text("PROCESSING", width/2, height/numLines*6);
    }
    

    The first version uses the names shown by PFont.list(). It works. The second version (the first I tried) uses the names I can see in the Wordpad font menu. It works too!
    Not sure if your problem is tied to the font you use (OTF? TTF?) or to your system or something else.

    Quicksand is an OTF font. The variants come from different files.

  • Hi,

    I seem to be having a similar issue. I'm on OS X 10.10.3 using processing 2.2.1

  • Mmm, re-reading the first post, I was a bit off. Here is a new version with a font with various weights and widths:

    PFont normal, semiBold, bold, condensed, condensedBold; 
    
    void setup()
    {
      size(800, 800);
      println(join(PFont.list(), "\n"));
    
      normal        = createFont("MyriadPro-Regular", 100);
      semiBold      = createFont("MyriadPro-Semibold", 100);
      bold          = createFont("MyriadPro-Bold", 100);
      condensed     = createFont("MyriadPro-Cond", 100);
      condensedBold = createFont("MyriadPro-BoldCond", 100);
    }
    
    void draw()
    {
      textAlign(CENTER, CENTER);
      int numLines = 8;
    
      textFont(normal);
      text("PROCESSING", width/2, height/numLines*3);
      textFont(semiBold);
      text("PROCESSING", width/2, height/numLines*4);
      textFont(bold);
      text("PROCESSING", width/2, height/numLines*5);
      textFont(condensed);
      text("PROCESSING", width/2, height/numLines*6);
      textFont(condensedBold);
      text("PROCESSING", width/2, height/numLines*7);
    }
    

    Still looking OK in Windows.

    ProcessingFonts

  • here's an output of the code above from OS X

  • OK, so if you have Myriad Pro with all these variants, then indeed you have a problem on OS X.

  • Hi both, there's definitely a discrepancy between OSX and Windows, though difficult to test further with the limited fonts I have installed. For one, the naming convention seems different. Spaces are not replaced/concatenated in my 3.0a5 on windows; the only way I can get the fonts created properly in Windows (8.1) is as per below (which confirms the format Pfont.list() prints out):

      light         = createFont("Calibri Light", 100);
      lightItalic   = createFont("Calibri Light Italic", 100);
      normal        = createFont("Calibri", 100);
      normalItalic  = createFont("Calibri Italic", 100);
      bold          = createFont("Calibri Bold", 100);
      boldItalic    = createFont("Calibri Bold Italic", 100);
    

    However, as I tried conveying in my first post, on the OSX side, things are much stranger-some entire fonts are not working, some are - mostly it's a few of the styles not working, most notably any "Light" or "Black" font versions. This seems related to the font files:

    
      // one .ttc file - osx; 
      // - only regular, bold, italic, bolditalic display as expected
      // - light displays as regular, lightItalic as italic
      // - black displays as bold, blackItalic as boldItalic
      light         = createFont("GillSans-Light", 100);
      lightItalic   = createFont("GillSans-LightItalic", 100);
      normal        = createFont("GillSans", 100);
      normalItalic  = createFont("GillSans-Italic", 100);
      bold          = createFont("GillSans-Bold", 100);
      boldItalic    = createFont("GillSans-BoldItalic", 100);
      black         = createFont("GillSans-UltraBold", 100);
      
      
      /*
      // one .tff per style - only have font in windows;
      //  all work as expected:
      light         = createFont("Calibri Light", 100);
      lightItalic   = createFont("Calibri Light Italic", 100);
      normal        = createFont("Calibri", 100);
      normalItalic  = createFont("Calibri Italic", 100);
      bold          = createFont("Calibri Bold", 100);
      boldItalic    = createFont("Calibri Bold Italic", 100);
      */
      
      /*
      // one .ttf per style - osx; 
      - all working
      normal        = createFont("Georgia", 100);
      normalItalic  = createFont("Georgia-Italic", 100);
      bold          = createFont("Georgia-Bold", 100);
      boldItalic    = createFont("Georgia-BoldItalic", 100);
      */
      
      /*
      // one .ttc file - osx; 
      // - only regular, bold, italic, bolditalic display as expected
      // - light displays as regular, lightItalic as italic
      // - black displays as bold, blackItalic as boldItalic
      light         = createFont("Superclarendon-Light", 100);
      lightItalic   = createFont("Superclarendon-LightItalic", 100);
      normal        = createFont("Superclarendon-Regular", 100);
      normalItalic  = createFont("Superclarendon-Italic", 100);
      bold          = createFont("Superclarendon-Bold", 100);
      boldItalic    = createFont("Superclarendon-BoldItalic", 100);
      black         = createFont("Superclarendon-Black", 100);
      */
      
      /*
      // single skia.ttf - osx; 
      // - all variants display as regular (variants below are listed in PFont.list())
      light         = createFont("Skia-Regular_Light", 100);
      lightItalic   = createFont("Skia-Regular_Light-Condensed", 100);
      normal        = createFont("Skia-Regular", 100);
      normalItalic  = createFont("Skia-Regular_Extended", 100);
      bold          = createFont("Skia-Regular_Bold", 100);
      boldItalic    = createFont("Skia-Regular_Black-Condensed", 100);
      black         = createFont("Skia-Regular_Black", 100);
      */
    
    
Sign In or Register to comment.