Post Reply 
Unicode char comparison puzzle
06-01-2018, 08:29 AM (This post was last modified: 06-01-2018 08:32 AM by Martin Hepperle.)
Post: #14
RE: Unicode char comparison puzzle
Some statistics:

PrimeSansMono.ttf ("Prime Sans Mono") has 613 glyphs
PrimeSansBold.ttf ("Prime Sans Bold") has 606 glyphs
PrimeSansFull.ttf ("Prime Sans") has 51279 glyphs
Printing out a character table of the latter is left as an exercise to the reader ;-)

And a small Java program (sorry no Prime here) to create a list of the code points:
Code:
   static void checkChars () throws FontFormatException, IOException
   {
      Font theFont = Font.createFont(Font.TRUETYPE_FONT,
            new File("d:/tmp/PrimeSansMono.ttf"));
      // or, if font is installed:
      // Font theFont = Font.decode("Prime Sans Mono");

      int nGlyphs = theFont.getNumGlyphs();

      System.out.println(theFont.getFontName() + " has " + nGlyphs
            + " glyphs and can display:");

      System.out.println();
      System.out.println("// "+theFont.getFontName() + " has " + nGlyphs
            + " glyphs:");
         System.out.println("glyphs := {");
         int i = 0;
         for ( int codePoint = 0; codePoint < Character.MAX_CODE_POINT; codePoint++ )
         {
            if ( theFont.canDisplay(codePoint) )
            {
               System.out.print( (codePoint));

               if ( i < nGlyphs-2 )
                  System.out.print(",");

               if ( (++i % 8) == 0 )
               {
                  // 8 characters per line
                  System.out.println();
               }
               else
               {
                  System.out.print(" ");
               }
            }
         }
         System.out.println("};");
   }
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Unicode char comparison puzzle - tcab - 05-30-2018, 12:50 PM
RE: Unicode char comparison puzzle - tcab - 05-31-2018, 01:34 AM
RE: Unicode char comparison puzzle - Tyann - 05-31-2018, 04:29 AM
RE: Unicode char comparison puzzle - tcab - 05-31-2018, 01:23 PM
RE: Unicode char comparison puzzle - Tyann - 06-01-2018, 04:30 AM
RE: Unicode char comparison puzzle - tcab - 06-01-2018, 07:48 AM
RE: Unicode char comparison puzzle - Martin Hepperle - 06-01-2018 08:29 AM
RE: Unicode char comparison puzzle - tcab - 06-01-2018, 10:35 AM



User(s) browsing this thread: 1 Guest(s)