All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gnu.app.redbook.StrokeFont Maven / Gradle / Ivy

Go to download

Escher is a collection of libraries for X Window System written purely in Java.

The newest version!
package gnu.app.redbook;

import gnu.x11.extension.glx.GL;


/**
 * Draw stroke (vector) font. To demonstrate display list. Modified from
 * stroke.c.
 *
 * @see 
 * screenshot
 * 
 * @see 
 * help output
 */
public class StrokeFont extends gnu.x11.extension.glx.Application {
  private static final String LINE1 = "A SPARE SERAPE APPEARS AS";
  private static final String LINE2 = "APES PREPARE RARE PEPPERS";

  private static final int POINT = 1;
  private static final int STROKE = 2;
  private static final int END = 3;

  private static final int [] [] LETTER_A = {
   {0, 0, POINT}, {0, 9, POINT}, {1, 10, POINT}, 
   {4, 10, POINT}, {5, 9, POINT}, {5, 0, STROKE}, 
   {0, 5, POINT}, {5, 5, END}
  };


  private static final int [] [] LETTER_E = {
   {5, 0, POINT}, {0, 0, POINT}, {0, 10, POINT}, 
   {5, 10, STROKE}, {0, 5, POINT}, {4, 5, END}
  };


  private static final int [] [] LETTER_P = {
   {0, 0, POINT}, {0, 10, POINT},  {4, 10, POINT}, 
   {5, 9, POINT}, {5, 6, POINT}, {4, 5, POINT}, 
   {0, 5, END}
  };


  private static final int [] [] LETTER_R = {
   {0, 0, POINT}, {0, 10, POINT},  {4, 10, POINT}, 
   {5, 9, POINT}, {5, 6, POINT}, {4, 5, POINT}, 
   {0, 5, STROKE}, {3, 5, POINT}, {5, 0, END}
  };


  private static final int [] [] LETTER_S = {
   {0, 1, POINT}, {1, 0, POINT}, {4, 0, POINT}, 
   {5, 1, POINT}, {5, 4, POINT}, {4, 5, POINT}, 
   {1, 5, POINT}, {0, 6, POINT}, {0, 9, POINT}, 
   {1, 10, POINT}, {4, 10, POINT}, {5, 9, END}
  };
    

  public StrokeFont (String [] args) {
    super (args, RESIZE_BIT);

    about ("0.1", "stroke font",
      "Stephen Tse ",
      "http://escher.sourceforge.net/");

    if (help_option) return;
    init_window (440, 120);

    gl.shade_model (GL.FLAT);
    init_letters ();
  }


  private void draw_letter (int [] [] letter) {
   gl.begin (GL.LINE_STRIP);

   for (int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy