• Categories
  • Recent Discussions
  • Unanswered
  • Categories

  • All Categories 25.7K
  • Announcements & Guidelines 13
  • Common Questions 30
  • Using Processing 22.1K
  • Programming Questions 12.2K
  • Questions about Code 6.4K
  • How To... 4.2K
  • Hello Processing 72
  • GLSL / Shaders 292
  • Library Questions 4K
  • Hardware, Integration & Other Languages 2.7K
  • Kinect 668
  • Arduino 1K
  • Raspberry PI 188
  • Questions about Modes 2K
  • Android Mode 1.3K
  • JavaScript Mode 413
  • Python Mode 205
  • Questions about Tools 100
  • Espanol 5
  • Developing Processing 548
  • Create & Announce Libraries 211
  • Create & Announce Modes 19
  • Create & Announce Tools 29
  • Summer of Code 2018 93
  • Rails Girls Summer of Code 2017 3
  • Summer of Code 2017 49
  • Summer of Code 2016 4
  • Summer of Code 2015 40
  • Summer of Code 2014 22
  • p5.js 1.6K
  • p5.js Programming Questions 947
  • p5.js Library Questions 315
  • p5.js Development Questions 31
  • General 1.4K
  • Share Your Work 678
  • Events & Opportunities 288
  • General Discussion 365
  • In this Discussion

    GoToLoop March 2015 hampus March 2015

    I am making a project where I need to write some letters, but no font include all of them. This means I need to change font when no glyph is found for a character in a corresponding font. Processing tells, for example, "No glyph found for the [] (\u771A) character" in the prompt when I write an unknown character. But how do I detect this in the program? Can't find any parameter in the processing language that changes if the glyph is missing ...

    Tagged:
  • createfont()
  • unicode
  • pfont
  • glyph
  • getglyph()
  • After perusing class PFont 's source code, found out that getGlyph() might help:
    https://github.com/processing/processing/blob/master/core/src/processing/core/PFont.java#L577

    PFont font = createFont("DejaVu Sans", 32, true);
    char ch = '\u171A';
    if (font.getGlyph(ch) == null)  println("Char ", ch, "is unavailable!");
    else                            println("Char ", ch, "is displayable!");
    exit();
    

    BtW, getGlyph() returns an already stored PFont.Glyph reference.