((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/gl-type" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.")) (section 2 "gl-type" (toc) (p "Simple Freetype font rendering in OpenGL with a single vertex buffer and texture.") (p "Only horizontal, left-to-right rendering is currently supported.") (section 3 "Requirements" (ul (li "freetype") (li "gl-utils") (li "miscmacros") (li "opengl-glew"))) (section 3 "Documentation" (def (sig (procedure " (load-face PATH SIZE [char-set: CHAR-SET] [mode: MODE])" (id load-face))) (p "Load the font face given by the " (link "http://freetype.org/" "Freetype-openable file") " pointed to by " (tt "PATH") " with a size of " (tt "SIZE") " pixels. " (tt "CHAR-SET") " is the " (link "http://srfi.schemers.org/srfi-14/srfi-14.html" "SRFI 14") " character-set that should be loaded, defaulting to " (tt "char-set:graphic") ". Any non-graphical characters in the set will waste space. " (tt "MODE") " is the mode in which the font should be rendered and should be one of " (tt "#:normal") " (the default) – for normally hinted, anti-aliased rendering – or " (tt "#:mono") " – for monochrome (aliased) rendering. Returns a " (tt "face") " record.")) (def (sig (record " face" (id face)) (procedure " (face? FACE)" (id face?)) (procedure " (face-atlas FACE)" (id face-atlas)) (procedure " (face-char-set FACE)" (id face-char-set)) (procedure " (face-height FACE)" (id face-height))) (p "The record type returned by " (tt "load-face") ".")) (def (sig (procedure " (string-mesh STRING FACE [line-spacing: SPACING] [max-width: MAX-WIDTH] [x: X] [y: Y] [mesh: MESH])" (id string-mesh))) (p "Render the given " (tt "STRING") " into a " (link "http://api.call-cc.org/doc/gl-utils/mesh" "gl-utils mesh") " with the provided " (tt "FACE") ". " (tt "SPACING") " is multiplied by the standard line advancement – a smaller spacing results in less space between successive lines – defaults to " (tt "1.3") ". If " (tt "MAX-WIDTH") " is provided, the string will be word-wrapped such that it does not exceed the given width. " (tt "X") " and " (tt "Y") " may be given to provide an offset to the rendered string’s origin. " (tt "MESH") " may be supplied in order to reuse a mesh previously created with " (tt "string-mesh") ". When " (tt "MESH") " is supplied, the number of graphical characters (non-whitespace characters in the char-set of " (tt "FACE") ") in " (tt "STRING") " must be equal to or less than the number of graphical characters in the string used to create " (tt "MESH") ".") (p "Strings are rendered with the upper-left corner of the text at the origin, with the dimensions of the mesh set in pixels. The mesh that is created has vertex attributes " (tt "position") " – a 2 element " (tt "#:float") " – and " (tt "tex-coord") " – a 2 element normalized " (tt "#:ushort") ", and " (tt "#:ushort") " indices.")) (def (sig (procedure " (string-width STRING FACE)" (id string-width))) (p "Returns the width, in pixels, of the " (tt "STRING") " if it were rendered with " (tt "FACE") ". Any non-graphical characters other than " (tt "#\\space") " will be ignored.")) (def (sig (parameter " (pixel-density-ratio)" (id pixel-density-ratio))) (p "Used to control the resolution at which fonts are rendered, defaulting to 1: each pixel unit corresponds to one display pixel. For most “Retina” displays a value of 2 should be used: each pixel unit corresponds to two display pixels."))) (section 3 "Examples" (p "See the " (link "https://github.com/AlexCharlton/gl-type/tree/master/examples" "examples directory") ".")) (section 3 "Version history" (section 4 "Version 0.3.0" (p "27 September 2014") (ul (li "Add support for high density displays"))) (section 4 "Version 0.2.0" (p "23 December 2014") (ul (li (tt "string-mesh") " accepts keyword " (tt "mesh") " argument"))) (section 4 "Version 0.1.0" (ul (li "Initial release")))) (section 3 "Source repository" (p "Source available on " (link "https://github.com/AlexCharlton/gl-type" "GitHub") ".") (p "Bug reports and patches welcome! Bugs can be reported via GitHub or to alex.n.charlton at gmail.")) (section 3 "Author" (p "Alex Charlton")) (section 3 "License" (p "BSD"))))