Glimmr Canvas-Based Drawing

version 2/101030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Section - Calculate the length of a rendered string

    To decide what number is the length of (stream - a rendered string):
        let len be 0;
        repeat with N running from 1 to the number of characters in the text-string of the stream:
            let V be the character code of position N of the text-string of the stream;
            if there is a char of V in the font table of the associated font of the stream:
                choose row with a char of V in the font table of the associated font of the stream;
            otherwise:
                choose row with a char of 32 in the font table of the associated font of the stream;
            increase len by the advance entry;
        decide on len.