1 /* 
    2  * ctx.h is free software; you can redistribute it and/or
    3  * modify it under the terms of the GNU Lesser General Public
    4  * License as published by the Free Software Foundation; either
    5  * version 3 of the License, or (at your option) any later version.
    6  *
    7  * ctx.h is distributed in the hope that it will be useful,
    8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   10  * Lesser General Public License for more details.
   11  *
   12  * You should have received a copy of the GNU Lesser General Public
   13  * License along with ctx; if not, see <https://www.gnu.org/licenses/>.
   14  *
   15  * 2012, 2015, 2019, 2020 Øyvind Kolås <pippin@gimp.org>
   16  *
   17  * ctx is a single header 2d vector graphics processing framework.
   18  *
   19  * To use ctx in a project, do the following:
   20  *
   21  * #define CTX_IMPLEMENTATION
   22  * #include "ctx.h"
   23  *
   24  * Ctx does not - yet - contain a minimal default fallback font, so
   25  * you probably want to also include a font, and perhaps enable
   26  * the cairo or SDL2 optional renderers, a more complete example
   27  * could be:
   28  *
   29  * #include <cairo.h>
   30  * #include <SDL.h>
   31  * #define CTX_IMPLEMENTATION
   32  * #include "ctx.h"
   33  *
   34  * The behavior of ctx can be tweaked, and features can be configured, 
   35  enabled
   36  * or disabled with other #defines, see further down in the start of this 
   37  file
   38  * for details.
   39  */
   40 
   41 #ifndef CTX_H
   42 #define CTX_H
   43 
   44 #ifdef __cplusplus
   45 extern "C" {
   46 #endif
   47 
   48 #include <stdint.h>
   49 #include <string.h>
   50 #include <stdio.h>
   51 
   52 typedef struct _Ctx            Ctx;
   53 
   54 /* The pixel formats supported as render targets
   55  */
   56 enum _CtxPixelFormat
   57 {
   58   CTX_FORMAT_NONE=0,
   59   CTX_FORMAT_GRAY8,
   60   CTX_FORMAT_GRAYA8,
   61   CTX_FORMAT_RGB8,
   62   CTX_FORMAT_RGBA8,
   63   CTX_FORMAT_BGRA8,
   64   CTX_FORMAT_RGB565,
   65   CTX_FORMAT_RGB565_BYTESWAPPED,
   66   CTX_FORMAT_RGB332,
   67   CTX_FORMAT_RGBAF,
   68   CTX_FORMAT_GRAYF,
   69   CTX_FORMAT_GRAYAF,
   70   CTX_FORMAT_GRAY1,
   71   CTX_FORMAT_GRAY2,
   72   CTX_FORMAT_GRAY4,
   73   CTX_FORMAT_CMYK8,
   74   CTX_FORMAT_CMYKA8,
   75   CTX_FORMAT_CMYKAF,
   76   CTX_FORMAT_DEVICEN1,
   77   CTX_FORMAT_DEVICEN2,
   78   CTX_FORMAT_DEVICEN3,
   79   CTX_FORMAT_DEVICEN4,
   80   CTX_FORMAT_DEVICEN5,
   81   CTX_FORMAT_DEVICEN6,
   82   CTX_FORMAT_DEVICEN7,
   83   CTX_FORMAT_DEVICEN8,
   84   CTX_FORMAT_DEVICEN9,
   85   CTX_FORMAT_DEVICEN10,
   86   CTX_FORMAT_DEVICEN11,
   87   CTX_FORMAT_DEVICEN12,
   88   CTX_FORMAT_DEVICEN13,
   89   CTX_FORMAT_DEVICEN14,
   90   CTX_FORMAT_DEVICEN15,
   91   CTX_FORMAT_DEVICEN16
   92 };
   93 typedef enum   _CtxPixelFormat CtxPixelFormat;
   94 
   95 typedef struct _CtxGlyph       CtxGlyph;
   96 
   97 /**
   98  * ctx_new:
   99  *
  100  * Create a new drawing context, this context has no pixels but
  101  * accumulates commands and can be played back on other ctx
  102  * render contexts.
  103  */
  104 Ctx *ctx_new (void);
  105 
  106 /**
  107  * ctx_new_for_framebuffer:
  108  *
  109  * Create a new drawing context for a framebuffer, rendering happens
  110  * immediately.
  111  */
  112 Ctx *ctx_new_for_framebuffer (void *data,
  113                               int   width,
  114                               int   height,
  115                               int   stride,
  116                               CtxPixelFormat pixel_format);
  117 /**
  118  * ctx_new_ui:
  119  *
  120  * Create a new interactive ctx context, might depend on additional
  121  * integration.
  122  */
  123 Ctx *ctx_new_ui (int width, int height);
  124 
  125 /**
  126  * ctx_new_for_drawlist:
  127  *
  128  * Create a new drawing context for a pre-existing drawlist.
  129  */
  130 Ctx *ctx_new_for_drawlist (void *data, size_t length);
  131 
  132 
  133 /**
  134  * ctx_dirty_rect:
  135  *
  136  * Query the dirtied bounding box of drawing commands thus far.
  137  */
  138 void  ctx_dirty_rect      (Ctx *ctx, int *x, int *y, int *width, int 
  139                            *height);
  140 
  141 /**
  142  * ctx_free:
  143  * @ctx: a ctx context
  144  */
  145 void ctx_free (Ctx *ctx);
  146 
  147 
  148 /* clears and resets a context */
  149 void ctx_reset          (Ctx *ctx);
  150 void ctx_begin_path     (Ctx *ctx);
  151 void ctx_save           (Ctx *ctx);
  152 void ctx_restore        (Ctx *ctx);
  153 void ctx_start_group    (Ctx *ctx);
  154 void ctx_end_group      (Ctx *ctx);
  155 void ctx_clip           (Ctx *ctx);
  156 void ctx_identity       (Ctx *ctx);
  157 void ctx_rotate         (Ctx *ctx, float x);
  158 
  159 #define CTX_LINE_WIDTH_HAIRLINE -1000.0
  160 #define CTX_LINE_WIDTH_ALIASED  -1.0
  161 #define CTX_LINE_WIDTH_FAST     -1.0  /* aliased 1px wide line */
  162 void ctx_miter_limit (Ctx *ctx, float limit);
  163 void ctx_line_width       (Ctx *ctx, float x);
  164 void ctx_apply_transform  (Ctx *ctx, float a,  float b,  // hscale, hskew
  165                            float c,  float d,  // vskew,  vscale
  166                            float e,  float f); // htran,  vtran
  167 void  ctx_line_dash       (Ctx *ctx, float *dashes, int count);
  168 void  ctx_font_size       (Ctx *ctx, float x);
  169 void  ctx_font            (Ctx *ctx, const char *font);
  170 void  ctx_scale           (Ctx *ctx, float x, float y);
  171 void  ctx_translate       (Ctx *ctx, float x, float y);
  172 void  ctx_line_to         (Ctx *ctx, float x, float y);
  173 void  ctx_move_to         (Ctx *ctx, float x, float y);
  174 void  ctx_curve_to        (Ctx *ctx, float cx0, float cy0,
  175                            float cx1, float cy1,
  176                            float x, float y);
  177 void  ctx_quad_to         (Ctx *ctx, float cx, float cy,
  178                            float x, float y);
  179 void  ctx_arc             (Ctx  *ctx,
  180                            float x, float y,
  181                            float radius,
  182                            float angle1, float angle2,
  183                            int   direction);
  184 void  ctx_arc_to          (Ctx *ctx, float x1, float y1,
  185                            float x2, float y2, float radius);
  186 void  ctx_rel_arc_to      (Ctx *ctx, float x1, float y1,
  187                            float x2, float y2, float radius);
  188 void  ctx_rectangle       (Ctx *ctx,
  189                            float x0, float y0,
  190                            float w, float h);
  191 void  ctx_round_rectangle (Ctx *ctx,
  192                            float x0, float y0,
  193                            float w, float h,
  194                            float radius);
  195 void  ctx_rel_line_to     (Ctx *ctx,
  196                            float x, float y);
  197 void  ctx_rel_move_to     (Ctx *ctx,
  198                            float x, float y);
  199 void  ctx_rel_curve_to    (Ctx *ctx,
  200                            float x0, float y0,
  201                            float x1, float y1,
  202                            float x2, float y2);
  203 void  ctx_rel_quad_to     (Ctx *ctx,
  204                            float cx, float cy,
  205                            float x, float y);
  206 void  ctx_close_path      (Ctx *ctx);
  207 float ctx_get_font_size   (Ctx *ctx);
  208 float ctx_get_line_width  (Ctx *ctx);
  209 int   ctx_width           (Ctx *ctx);
  210 int   ctx_height          (Ctx *ctx);
  211 int   ctx_rev             (Ctx *ctx);
  212 float ctx_x               (Ctx *ctx);
  213 float ctx_y               (Ctx *ctx);
  214 void  ctx_current_point   (Ctx *ctx, float *x, float *y);
  215 void  ctx_get_transform   (Ctx *ctx, float *a, float *b,
  216                            float *c, float *d,
  217                            float *e, float *f);
  218 
  219 CtxGlyph *ctx_glyph_allocate (int n_glyphs);
  220 
  221 void gtx_glyph_free       (CtxGlyph *glyphs);
  222 
  223 int  ctx_glyph            (Ctx *ctx, uint32_t unichar, int stroke);
  224 
  225 void ctx_arc              (Ctx  *ctx,
  226                            float x, float y,
  227                            float radius,
  228                            float angle1, float angle2,
  229                            int   direction);
  230 
  231 void ctx_arc_to           (Ctx *ctx, float x1, float y1,
  232                            float x2, float y2, float radius);
  233 
  234 void ctx_quad_to          (Ctx *ctx, float cx, float cy,
  235                            float x, float y);
  236 
  237 void ctx_arc              (Ctx  *ctx,
  238                            float x, float y,
  239                            float radius,
  240                            float angle1, float angle2,
  241                            int   direction);
  242 
  243 void ctx_arc_to           (Ctx *ctx, float x1, float y1,
  244                            float x2, float y2, float radius);
  245 
  246 void ctx_preserve         (Ctx *ctx);
  247 void ctx_fill             (Ctx *ctx);
  248 void ctx_stroke           (Ctx *ctx);
  249 void ctx_parse            (Ctx *ctx, const char *string);
  250 
  251 void ctx_shadow_rgba      (Ctx *ctx, float r, float g, float b, float a);
  252 void ctx_shadow_blur      (Ctx *ctx, float x);
  253 void ctx_shadow_offset_x  (Ctx *ctx, float x);
  254 void ctx_shadow_offset_y  (Ctx *ctx, float y);
  255 void ctx_view_box         (Ctx *ctx,
  256                            float x0, float y0,
  257                            float w, float h);
  258 void
  259 ctx_set_pixel_u8          (Ctx *ctx, uint16_t x, uint16_t y, uint8_t r, 
  260                            uint8_t g, uint8_t b, uint8_t a);
  261 
  262 void  ctx_global_alpha     (Ctx *ctx, float global_alpha);
  263 float ctx_get_global_alpha (Ctx *ctx);
  264 
  265 void ctx_named_source (Ctx *ctx, const char *name);
  266 // followed by a color, gradient or pattern definition
  267 
  268 void ctx_rgba   (Ctx *ctx, float r, float g, float b, float a);
  269 void ctx_rgb    (Ctx *ctx, float r, float g, float b);
  270 void ctx_gray   (Ctx *ctx, float gray);
  271 void ctx_rgba8  (Ctx *ctx, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
  272 void ctx_drgba  (Ctx *ctx, float r, float g, float b, float a);
  273 void ctx_cmyka  (Ctx *ctx, float c, float m, float y, float k, float a);
  274 void ctx_cmyk   (Ctx *ctx, float c, float m, float y, float k);
  275 void ctx_dcmyka (Ctx *ctx, float c, float m, float y, float k, float a);
  276 void ctx_dcmyk  (Ctx *ctx, float c, float m, float y, float k);
  277 
  278 /* there is also getters for colors, by first setting a color in one format 
  279 and getting
  280  * it with another color conversions can be done
  281  */
  282 
  283 void ctx_get_rgba   (Ctx *ctx, float *rgba);
  284 void ctx_get_graya  (Ctx *ctx, float *ya);
  285 void ctx_get_drgba  (Ctx *ctx, float *drgba);
  286 void ctx_get_cmyka  (Ctx *ctx, float *cmyka);
  287 void ctx_get_dcmyka (Ctx *ctx, float *dcmyka);
  288 int  ctx_in_fill    (Ctx *ctx, float x, float y);
  289 int  ctx_in_stroke  (Ctx *ctx, float x, float y);
  290 
  291 void ctx_linear_gradient (Ctx *ctx, float x0, float y0, float x1, float y1);
  292 void ctx_radial_gradient (Ctx *ctx, float x0, float y0, float r0,
  293                           float x1, float y1, float r1);
  294 /* XXX should be ctx_gradient_add_stop_rgba */
  295 void ctx_gradient_add_stop (Ctx *ctx, float pos, float r, float g, float b, 
  296                             float a);
  297 
  298 void ctx_gradient_add_stop_u8 (Ctx *ctx, float pos, uint8_t r, uint8_t g, 
  299                                uint8_t b, uint8_t a);
  300 
  301 /*ctx_texture_init:
  302  *
  303  * return value: the actual id assigned, if id is out of range - or later
  304  * when -1 as id will mean auto-assign.
  305  */
  306 int ctx_texture_init (Ctx *ctx,
  307                       int id,
  308                       int width,
  309                       int height,
  310                       int stride,
  311                       CtxPixelFormat format,
  312                       uint8_t *pixels,
  313                       /* XXX : add stride - in bytes ? */
  314                       void (*freefunc) (void *pixels, void *user_data),
  315                       void *user_data);
  316 int ctx_texture_load        (Ctx *ctx, int id, const char *path);
  317 int ctx_texture_load_memory (Ctx *ctx, int id, const char *data, int length)
  318                              ;
  319 void ctx_texture_release    (Ctx *ctx, int id);
  320 void ctx_texture            (Ctx *ctx, int id, float x, float y);
  321 
  322 void ctx_image_path (Ctx *ctx, const char *path, float x, float y);
  323 
  324 typedef struct _CtxDrawlist CtxDrawlist;
  325 typedef void (*CtxFullCb) (CtxDrawlist *drawlist, void *data);
  326 
  327 int ctx_pixel_format_bpp        (CtxPixelFormat format);
  328 int ctx_pixel_format_components (CtxPixelFormat format);
  329 
  330 void _ctx_set_store_clear (Ctx *ctx);
  331 void _ctx_set_transformation (Ctx *ctx, int transformation);
  332 
  333 Ctx *ctx_hasher_new (int width, int height, int cols, int rows);
  334 uint8_t *ctx_hasher_get_hash (Ctx *ctx, int col, int row);
  335 
  336 int ctx_utf8_strlen (const char *s);
  337 
  338 #ifdef _BABL_H
  339 #define CTX_BABL 1
  340 #else
  341 #define CTX_BABL 0
  342 #endif
  343 
  344 /* If cairo.h is included before ctx.h add cairo integration code
  345  */
  346 #ifdef CAIRO_H
  347 #define CTX_CAIRO 1
  348 #else
  349 #define CTX_CAIRO 0
  350 #endif
  351 
  352 #ifdef SDL_h_
  353 #define CTX_SDL 1
  354 #else
  355 #define CTX_SDL 0
  356 #endif
  357 
  358 #ifndef CTX_FB
  359 #if CTX_SDL
  360 #define CTX_FB 1
  361 #else
  362 #define CTX_FB 0
  363 #endif
  364 #endif
  365 
  366 #if CTX_SDL
  367 #define ctx_mutex_t            SDL_mutex
  368 #define ctx_create_mutex()     SDL_CreateMutex()
  369 #define ctx_lock_mutex(a)      SDL_LockMutex(a)
  370 #define ctx_unlock_mutex(a)    SDL_UnlockMutex(a)
  371 #else
  372 #define ctx_mutex_t           int
  373 #define ctx_create_mutex()    NULL
  374 #define ctx_lock_mutex(a)   
  375 #define ctx_unlock_mutex(a)  
  376 #endif
  377 
  378 #if CTX_CAIRO
  379 
  380 /* render the deferred commands of a ctx context to a cairo
  381  * context
  382  */
  383 void  ctx_render_cairo  (Ctx *ctx, cairo_t *cr);
  384 
  385 /* create a ctx context that directly renders to the specified
  386  * cairo context
  387  */
  388 Ctx * ctx_new_for_cairo (cairo_t *cr);
  389 #endif
  390 
  391 /* free with free() */
  392 char *ctx_render_string (Ctx *ctx, int longform, int *retlen);
  393 
  394 void ctx_render_stream  (Ctx *ctx, FILE *stream, int formatter);
  395 
  396 void ctx_render_ctx     (Ctx *ctx, Ctx *d_ctx);
  397 
  398 void ctx_start_move     (Ctx *ctx);
  399 
  400 
  401 int ctx_add_single      (Ctx *ctx, void *entry);
  402 
  403 uint32_t ctx_utf8_to_unichar (const char *input);
  404 int      ctx_unichar_to_utf8 (uint32_t  ch, uint8_t  *dest);
  405 
  406 
  407 typedef enum
  408 {
  409   CTX_FILL_RULE_EVEN_ODD,
  410   CTX_FILL_RULE_WINDING
  411 } CtxFillRule;
  412 
  413 typedef enum
  414 {
  415   CTX_COMPOSITE_SOURCE_OVER,
  416   CTX_COMPOSITE_COPY,
  417   CTX_COMPOSITE_SOURCE_IN,
  418   CTX_COMPOSITE_SOURCE_OUT,
  419   CTX_COMPOSITE_SOURCE_ATOP,
  420   CTX_COMPOSITE_CLEAR,
  421 
  422   CTX_COMPOSITE_DESTINATION_OVER,
  423   CTX_COMPOSITE_DESTINATION,
  424   CTX_COMPOSITE_DESTINATION_IN,
  425   CTX_COMPOSITE_DESTINATION_OUT,
  426   CTX_COMPOSITE_DESTINATION_ATOP,
  427   CTX_COMPOSITE_XOR,
  428 } CtxCompositingMode;
  429 
  430 typedef enum
  431 {
  432   CTX_BLEND_NORMAL,
  433   CTX_BLEND_MULTIPLY,
  434   CTX_BLEND_SCREEN,
  435   CTX_BLEND_OVERLAY,
  436   CTX_BLEND_DARKEN,
  437   CTX_BLEND_LIGHTEN,
  438   CTX_BLEND_COLOR_DODGE,
  439   CTX_BLEND_COLOR_BURN,
  440   CTX_BLEND_HARD_LIGHT,
  441   CTX_BLEND_SOFT_LIGHT,
  442   CTX_BLEND_DIFFERENCE,
  443   CTX_BLEND_EXCLUSION,
  444   CTX_BLEND_HUE, 
  445   CTX_BLEND_SATURATION, 
  446   CTX_BLEND_COLOR, 
  447   CTX_BLEND_LUMINOSITY,  // 15
  448   CTX_BLEND_DIVIDE,
  449   CTX_BLEND_ADDITION,
  450   CTX_BLEND_SUBTRACT,    // 18
  451 } CtxBlend;
  452 
  453 void ctx_blend_mode (Ctx *ctx, CtxBlend mode);
  454 
  455 typedef enum
  456 {
  457   CTX_JOIN_BEVEL = 0,
  458   CTX_JOIN_ROUND = 1,
  459   CTX_JOIN_MITER = 2
  460 } CtxLineJoin;
  461 
  462 typedef enum
  463 {
  464   CTX_CAP_NONE   = 0,
  465   CTX_CAP_ROUND  = 1,
  466   CTX_CAP_SQUARE = 2
  467 } CtxLineCap;
  468 
  469 typedef enum
  470 {
  471   CTX_TEXT_BASELINE_ALPHABETIC = 0,
  472   CTX_TEXT_BASELINE_TOP,
  473   CTX_TEXT_BASELINE_HANGING,
  474   CTX_TEXT_BASELINE_MIDDLE,
  475   CTX_TEXT_BASELINE_IDEOGRAPHIC,
  476   CTX_TEXT_BASELINE_BOTTOM
  477 } CtxTextBaseline;
  478 
  479 typedef enum
  480 {
  481   CTX_TEXT_ALIGN_START = 0,
  482   CTX_TEXT_ALIGN_END,
  483   CTX_TEXT_ALIGN_CENTER,
  484   CTX_TEXT_ALIGN_LEFT,
  485   CTX_TEXT_ALIGN_RIGHT
  486 } CtxTextAlign;
  487 
  488 typedef enum
  489 {
  490   CTX_TEXT_DIRECTION_INHERIT = 0,
  491   CTX_TEXT_DIRECTION_LTR,
  492   CTX_TEXT_DIRECTION_RTL
  493 } CtxTextDirection;
  494 
  495 struct
  496 _CtxGlyph
  497 {
  498   uint32_t index;
  499   float    x;
  500   float    y;
  501 };
  502 
  503 void ctx_text_align           (Ctx *ctx, CtxTextAlign      align);
  504 void ctx_text_baseline        (Ctx *ctx, CtxTextBaseline   baseline);
  505 void ctx_text_direction       (Ctx *ctx, CtxTextDirection  direction);
  506 void ctx_fill_rule            (Ctx *ctx, CtxFillRule       fill_rule);
  507 void ctx_line_cap             (Ctx *ctx, CtxLineCap        cap);
  508 void ctx_line_join            (Ctx *ctx, CtxLineJoin       join);
  509 void ctx_compositing_mode     (Ctx *ctx, CtxCompositingMode mode);
  510 int  ctx_set_drawlist     (Ctx *ctx, void *data, int length);
  511 typedef struct _CtxEntry CtxEntry;
  512 /* we only care about the tight packing for this specific
  513  * structx as we do indexing across members in arrays of it,
  514  * to make sure its size becomes 9bytes -
  515  * the pack pragma is also sufficient on recent gcc versions
  516  */
  517 #pragma pack(push,1)
  518 struct
  519   _CtxEntry
  520 {
  521   uint8_t code;
  522   union
  523   {
  524     float    f[2];
  525     uint8_t  u8[8];
  526     int8_t   s8[8];
  527     uint16_t u16[4];
  528     int16_t  s16[4];
  529     uint32_t u32[2];
  530     int32_t  s32[2];
  531     uint64_t u64[1]; // unused
  532   } data; // 9bytes long, we're favoring compactness and correctness
  533   // over performance. By sacrificing float precision, zeroing
  534   // first 8bit of f[0] would permit 8bytes long and better
  535   // aglinment and cacheline behavior.
  536 };
  537 #pragma pack(pop)
  538 const CtxEntry *ctx_get_drawlist (Ctx *ctx);
  539 int  ctx_append_drawlist  (Ctx *ctx, void *data, int length);
  540 
  541 /* these are only needed for clients rendering text, as all text gets
  542  * converted to paths.
  543  */
  544 void  ctx_glyphs        (Ctx        *ctx,
  545                          CtxGlyph   *glyphs,
  546                          int         n_glyphs);
  547 
  548 void  ctx_glyphs_stroke (Ctx       *ctx,
  549                          CtxGlyph   *glyphs,
  550                          int         n_glyphs);
  551 
  552 void  ctx_text          (Ctx        *ctx,
  553                          const char *string);
  554 
  555 void  ctx_text_stroke   (Ctx        *ctx,
  556                          const char *string);
  557 
  558 /* returns the total horizontal advance if string had been rendered */
  559 float ctx_text_width    (Ctx        *ctx,
  560                          const char *string);
  561 
  562 float ctx_glyph_width   (Ctx *ctx, int unichar);
  563 
  564 int   ctx_load_font_ttf (const char *name, const void *ttf_contents, int 
  565                          length);
  566 
  567 void ctx_set_texture_source (Ctx *ctx, Ctx *texture_source);
  568 
  569 
  570 enum _CtxModifierState
  571 {
  572   CTX_MODIFIER_STATE_SHIFT   = (1<<0),
  573   CTX_MODIFIER_STATE_CONTROL = (1<<1),
  574   CTX_MODIFIER_STATE_ALT     = (1<<2),
  575   CTX_MODIFIER_STATE_BUTTON1 = (1<<3),
  576   CTX_MODIFIER_STATE_BUTTON2 = (1<<4),
  577   CTX_MODIFIER_STATE_BUTTON3 = (1<<5),
  578   CTX_MODIFIER_STATE_DRAG    = (1<<6), // pointer button is down (0 or any)
  579 };
  580 typedef enum _CtxModifierState CtxModifierState;
  581 
  582 enum _CtxScrollDirection
  583 {
  584   CTX_SCROLL_DIRECTION_UP,
  585   CTX_SCROLL_DIRECTION_DOWN,
  586   CTX_SCROLL_DIRECTION_LEFT,
  587   CTX_SCROLL_DIRECTION_RIGHT
  588 };
  589 typedef enum _CtxScrollDirection CtxScrollDirection;
  590 
  591 typedef struct _CtxEvent CtxEvent;
  592 
  593 void ctx_set_renderer (Ctx *ctx,
  594                        void *renderer);
  595 void *ctx_get_renderer (Ctx *ctx);
  596 
  597 /* the following API is only available when CTX_EVENTS is defined to 1
  598  *
  599  * it provides the ability to register callbacks with the current path
  600  * that get delivered with transformed coordinates.
  601  */
  602 unsigned long ctx_ticks (void);
  603 int ctx_is_dirty (Ctx *ctx);
  604 void ctx_set_dirty (Ctx *ctx, int dirty);
  605 float ctx_get_float (Ctx *ctx, uint32_t hash);
  606 void ctx_set_float (Ctx *ctx, uint32_t hash, float value);
  607 
  608 unsigned long ctx_ticks (void);
  609 void ctx_flush (Ctx *ctx);
  610 
  611 void ctx_set_clipboard (Ctx *ctx, const char *text);
  612 char *ctx_get_clipboard (Ctx *ctx);
  613 
  614 void _ctx_events_init     (Ctx *ctx);
  615 typedef struct _CtxRectangle CtxRectangle;
  616 struct _CtxRectangle {
  617   int x;
  618   int y;
  619   int width;
  620   int height;
  621 };
  622 
  623 void ctx_quit (Ctx *ctx);
  624 int  ctx_has_quit (Ctx *ctx);
  625 
  626 typedef void (*CtxCb) (CtxEvent *event,
  627                        void     *data,
  628                        void     *data2);
  629 typedef void (*CtxDestroyNotify) (void *data);
  630 
  631 enum _CtxEventType {
  632   CTX_PRESS          = 1 << 0,
  633   CTX_MOTION         = 1 << 1,
  634   CTX_RELEASE        = 1 << 2,
  635   CTX_ENTER          = 1 << 3,
  636   CTX_LEAVE          = 1 << 4,
  637   CTX_TAP            = 1 << 5,
  638   CTX_TAP_AND_HOLD   = 1 << 6,
  639 
  640   /* NYI: SWIPE, ZOOM ROT_ZOOM, */
  641 
  642   CTX_DRAG_PRESS     = 1 << 7,
  643   CTX_DRAG_MOTION    = 1 << 8,
  644   CTX_DRAG_RELEASE   = 1 << 9,
  645   CTX_KEY_DOWN       = 1 << 10,
  646   CTX_KEY_UP         = 1 << 11,
  647   CTX_SCROLL         = 1 << 12,
  648   CTX_MESSAGE        = 1 << 13,
  649   CTX_DROP           = 1 << 14,
  650 
  651   CTX_SET_CURSOR= 1 << 15, // used internally
  652 
  653   /* client should store state - preparing
  654                                  * for restart
  655                                  */
  656   CTX_POINTER  = (CTX_PRESS | CTX_MOTION | CTX_RELEASE | CTX_DROP),
  657   CTX_TAPS     = (CTX_TAP | CTX_TAP_AND_HOLD),
  658   CTX_CROSSING = (CTX_ENTER | CTX_LEAVE),
  659   CTX_DRAG     = (CTX_DRAG_PRESS | CTX_DRAG_MOTION | CTX_DRAG_RELEASE),
  660   CTX_KEY      = (CTX_KEY_DOWN | CTX_KEY_UP),
  661   CTX_MISC     = (CTX_MESSAGE),
  662   CTX_ANY      = (CTX_POINTER | CTX_DRAG | CTX_CROSSING | CTX_KEY | 
  663                  CTX_MISC | CTX_TAPS),
  664 };
  665 typedef enum _CtxEventType CtxEventType;
  666 
  667 #define CTX_CLICK   CTX_PRESS   // SHOULD HAVE MORE LOGIC
  668 
  669 struct _CtxEvent {
  670   CtxEventType  type;
  671   uint32_t time;
  672   Ctx     *ctx;
  673   int stop_propagate; /* when set - propagation is stopped */
  674 
  675   CtxModifierState state;
  676 
  677   int      device_no; /* 0 = left mouse button / virtual focus */
  678                       /* 1 = middle mouse button */
  679                       /* 2 = right mouse button */
  680                       /* 3 = first multi-touch .. (NYI) */
  681 
  682   float   device_x; /* untransformed (device) coordinates  */
  683   float   device_y;
  684 
  685   /* coordinates; and deltas for motion/drag events in user-coordinates: */
  686   float   x;
  687   float   y;
  688   float   start_x; /* start-coordinates (press) event for drag, */
  689   float   start_y; /*    untransformed coordinates */
  690   float   prev_x;  /* previous events coordinates */
  691   float   prev_y;
  692   float   delta_x; /* x - prev_x, redundant - but often useful */
  693   float   delta_y; /* y - prev_y, redundant - ..  */
  694 
  695 
  696   unsigned int unicode; /* only valid for key-events */
  697   const char *string;   /* as key can be "up" "down" "space" "backspace" 
  698   "a" "b" "ø" etc .. */
  699                         /* this is also where the message is delivered for
  700                          * MESSAGE events
  701                          *
  702                          * and the data for drop events are delivered
  703                          */
  704   CtxScrollDirection scroll_direction;
  705 
  706 
  707   // would be nice to add the bounding box of the hit-area causing
  708   // the event, making for instance scissored enter/leave repaint easier.
  709 };
  710 
  711 // layer-event "layer"  motion x y device_no 
  712 
  713 void ctx_add_key_binding_full (Ctx *ctx,
  714                                const char *key,
  715                                const char *action,
  716                                const char *label,
  717                                CtxCb       cb,
  718                                void       *cb_data,
  719                                CtxDestroyNotify destroy_notify,
  720                                void       *destroy_data);
  721 void ctx_add_key_binding (Ctx *ctx,
  722                           const char *key,
  723                           const char *action,
  724                           const char *label,
  725                           CtxCb cb,
  726                           void  *cb_data);
  727 typedef struct CtxBinding {
  728   char *nick;
  729   char *command;
  730   char *label;
  731   CtxCb cb;
  732   void *cb_data;
  733   CtxDestroyNotify destroy_notify;
  734   void  *destroy_data;
  735 } CtxBinding;
  736 CtxBinding *ctx_get_bindings (Ctx *ctx);
  737 void  ctx_clear_bindings     (Ctx *ctx);
  738 void  ctx_remove_idle        (Ctx *ctx, int handle);
  739 int   ctx_add_timeout_full   (Ctx *ctx, int ms, int (*idle_cb)(Ctx *ctx, 
  740                               void *idle_data), void *idle_data,
  741                               void (*destroy_notify)(void *destroy_data), 
  742                                     void *destroy_data);
  743 int   ctx_add_timeout        (Ctx *ctx, int ms, int (*idle_cb)(Ctx *ctx, 
  744                               void *idle_data), void *idle_data);
  745 int   ctx_add_idle_full      (Ctx *ctx, int (*idle_cb)(Ctx *ctx, void 
  746                               *idle_data), void *idle_data,
  747                               void (*destroy_notify)(void *destroy_data), 
  748                                     void *destroy_data);
  749 int   ctx_add_idle           (Ctx *ctx, int (*idle_cb)(Ctx *ctx, void 
  750                               *idle_data), void *idle_data);
  751 
  752 
  753 void ctx_add_hit_region (Ctx *ctx, const char *id);
  754 
  755 void ctx_listen_full (Ctx     *ctx,
  756                       float    x,
  757                       float    y,
  758                       float    width,
  759                       float    height,
  760                       CtxEventType  types,
  761                       CtxCb    cb,
  762                       void    *data1,
  763                       void    *data2,
  764                       void   (*finalize)(void *listen_data, void 
  765                               *listen_data2,
  766                                          void *finalize_data),
  767                       void    *finalize_data);
  768 void  ctx_event_stop_propagate (CtxEvent *event);
  769 void  ctx_listen               (Ctx          *ctx,
  770                                 CtxEventType  types,
  771                                 CtxCb         cb,
  772                                 void*         data1,
  773                                 void*         data2);
  774 void  ctx_listen_with_finalize (Ctx          *ctx,
  775                                 CtxEventType  types,
  776                                 CtxCb         cb,
  777                                 void*         data1,
  778                                 void*         data2,
  779                       void   (*finalize)(void *listen_data, void 
  780                               *listen_data2,
  781                                          void *finalize_data),
  782                       void    *finalize_data);
  783 
  784 void ctx_init (int *argc, char ***argv); // is a no-op but could launch
  785                                          // terminal
  786 CtxEvent *ctx_get_event (Ctx *ctx);
  787 
  788 int   ctx_pointer_is_down (Ctx *ctx, int no);
  789 float ctx_pointer_x (Ctx *ctx);
  790 float ctx_pointer_y (Ctx *ctx);
  791 void  ctx_freeze (Ctx *ctx);
  792 void  ctx_thaw   (Ctx *ctx);
  793 int   ctx_events_frozen (Ctx *ctx);
  794 void  ctx_events_clear_items (Ctx *ctx);
  795 int   ctx_events_width (Ctx *ctx);
  796 int   ctx_events_height (Ctx *ctx);
  797 
  798 /* The following functions drive the event delivery, registered callbacks
  799  * are called in response to these being called.
  800  */
  801 
  802 int ctx_key_press (Ctx *ctx, unsigned int keyval,
  803                    const char *string, uint32_t time);
  804 int ctx_scrolled  (Ctx *ctx, float x, float y, CtxScrollDirection 
  805                    scroll_direction, uint32_t time);
  806 void ctx_incoming_message (Ctx *ctx, const char *message, long time);
  807 int ctx_pointer_motion    (Ctx *ctx, float x, float y, int device_no, 
  808                            uint32_t time);
  809 int ctx_pointer_release   (Ctx *ctx, float x, float y, int device_no, 
  810                            uint32_t time);
  811 int ctx_pointer_press     (Ctx *ctx, float x, float y, int device_no, 
  812                            uint32_t time);
  813 int ctx_pointer_drop      (Ctx *ctx, float x, float y, int device_no, 
  814                            uint32_t time,
  815                            char *string);
  816 
  817 
  818 typedef enum
  819 {
  820   CTX_CONT             = '\0', // - contains args from preceding entry
  821   CTX_NOP              = ' ', //
  822   CTX_DATA             = '(', // size size-in-entries - u32
  823   CTX_DATA_REV         = ')', // reverse traversal data marker
  824   CTX_SET_RGBA_U8      = '*', // r g b a - u8
  825   CTX_NEW_EDGE         = '+', // x0 y0 x1 y1 - s16
  826   // set pixel might want a shorter ascii form? or keep it an embedded
  827   // only option?
  828   CTX_SET_PIXEL        = '-', // 8bit "fast-path" r g b a x y - u8 for rgba,
  829                          and u16 for x,y
  830   /* optimizations that reduce the number of entries used,
  831    * not visible outside the drawlist compression, thus
  832    * using entries that cannot be used directly as commands
  833    * since they would be interpreted as numbers - if values>127
  834    * then the embedded font data is harder to escape.
  835    */
  836   CTX_REL_LINE_TO_X4            = '0', // x1 y1 x2 y2 x3 y3 x4 y4   -- s8
  837   CTX_REL_LINE_TO_REL_CURVE_TO  = '1', // x1 y1 cx1 cy1 cx2 cy2 x y -- s8
  838   CTX_REL_CURVE_TO_REL_LINE_TO  = '2', // cx1 cy1 cx2 cy2 x y x1 y1 -- s8
  839   CTX_REL_CURVE_TO_REL_MOVE_TO  = '3', // cx1 cy1 cx2 cy2 x y x1 y1 -- s8
  840   CTX_REL_LINE_TO_X2            = '4', // x1 y1 x2 y2 -- s16
  841   CTX_MOVE_TO_REL_LINE_TO       = '5', // x1 y1 x2 y2 -- s16
  842   CTX_REL_LINE_TO_REL_MOVE_TO   = '6', // x1 y1 x2 y2 -- s16
  843   CTX_FILL_MOVE_TO              = '7', // x y
  844   CTX_REL_QUAD_TO_REL_QUAD_TO   = '8', // cx1 x1 cy1 y1 cx1 x2 cy1 y1 -- s8
  845   CTX_REL_QUAD_TO_S16           = '9', // cx1 cy1 x y                 - s16
  846   // expand with: . : 
  847   CTX_FLUSH            = ';',
  848 
  849   CTX_DEFINE_GLYPH     = '@', // unichar width - u32
  850   CTX_ARC_TO           = 'A', // x1 y1 x2 y2 radius
  851   CTX_ARC              = 'B', // x y radius angle1 angle2 direction
  852   CTX_CURVE_TO         = 'C', // cx1 cy1 cx2 cy2 x y
  853   CTX_STROKE           = 'E', //
  854   CTX_FILL             = 'F', //
  855   CTX_RESTORE          = 'G', //
  856   CTX_HOR_LINE_TO      = 'H', // x
  857   CTX_BITPIX           = 'I', // x, y, width, height, scale // NYI
  858   CTX_ROTATE           = 'J', // radians
  859   CTX_COLOR            = 'K', // model, c1 c2 c3 ca - has a variable set of
  860   // arguments.
  861   CTX_LINE_TO          = 'L', // x y
  862   CTX_MOVE_TO          = 'M', // x y
  863   CTX_BEGIN_PATH       = 'N', //
  864   CTX_SCALE            = 'O', // xscale yscale
  865   CTX_NEW_PAGE         = 'P', // - NYI - optional page-size
  866   CTX_QUAD_TO          = 'Q', // cx cy x y
  867   CTX_VIEW_BOX         = 'R', // x y width height
  868   CTX_SMOOTH_TO        = 'S', // cx cy x y
  869   CTX_SMOOTHQ_TO       = 'T', // x y
  870   CTX_RESET            = 'U', //
  871   CTX_VER_LINE_TO      = 'V', // y
  872   CTX_APPLY_TRANSFORM  = 'W', // a b c d e f - for set_transform combine 
  873                          with identity
  874   CTX_EXIT             = 'X', //
  875   CTX_ROUND_RECTANGLE  = 'Y', // x y width height radius
  876 
  877   CTX_CLOSE_PATH2      = 'Z', //
  878   CTX_KERNING_PAIR     = '[', // glA glB kerning, glA and glB in u16 
  879                          kerning in s32
  880   CTX_COLOR_SPACE      = ']', // IccSlot  data  data_len,
  881                          //    data can be a string with a name,
  882                          //    icc data or perhaps our own serialization
  883                          //    of profile data
  884   CTX_EDGE_FLIPPED     = '`', // x0 y0 x1 y1 - s16
  885   CTX_REL_ARC_TO       = 'a', // x1 y1 x2 y2 radius
  886   CTX_CLIP             = 'b',
  887   CTX_REL_CURVE_TO     = 'c', // cx1 cy1 cx2 cy2 x y
  888   CTX_LINE_DASH        = 'd', // dashlen0 [dashlen1 ...]
  889   CTX_TRANSLATE        = 'e', // x y
  890   CTX_LINEAR_GRADIENT  = 'f', // x1 y1 x2 y2
  891   CTX_SAVE             = 'g',
  892   CTX_REL_HOR_LINE_TO  = 'h', // x
  893   CTX_TEXTURE          = 'i',
  894   CTX_PRESERVE         = 'j', // 
  895   CTX_SET_KEY          = 'k', // - used together with another char to 
  896                          identify
  897                               //   a key to set
  898   CTX_REL_LINE_TO      = 'l', // x y
  899   CTX_REL_MOVE_TO      = 'm', // x y
  900   CTX_FONT             = 'n', // as used by text parser
  901   CTX_RADIAL_GRADIENT  = 'o', // x1 y1 radius1 x2 y2 radius2
  902   CTX_GRADIENT_STOP    = 'p', // argument count depends on current color 
  903                          model
  904   CTX_REL_QUAD_TO      = 'q', // cx cy x y
  905   CTX_RECTANGLE        = 'r', // x y width height
  906   CTX_REL_SMOOTH_TO    = 's', // cx cy x y
  907   CTX_REL_SMOOTHQ_TO   = 't', // x y
  908   CTX_TEXT_STROKE      = 'u', // string - utf8 string
  909   CTX_REL_VER_LINE_TO  = 'v', // y
  910   CTX_GLYPH            = 'w', // unichar fontsize
  911   CTX_TEXT             = 'x', // string | kern - utf8 data to shape or 
  912                          horizontal kerning amount
  913   CTX_IDENTITY         = 'y', //
  914   CTX_CLOSE_PATH       = 'z', //
  915   CTX_START_GROUP      = '{',
  916   CTX_END_GROUP        = '}',
  917   CTX_EDGE             = ',',
  918 
  919   /* though expressed as two chars in serialization we have
  920    * dedicated byte commands for the setters to keep the dispatch
  921    * simpler. There is no need for these to be human readable thus we go >
  922    128
  923    *
  924    * unused/reserved: D!&<=>?#:.^_=/~%\'"
  925    *
  926    */
  927   CTX_FILL_RULE        = 128, // kr rule - u8, default = 
  928                          CTX_FILLE_RULE_EVEN_ODD
  929   CTX_BLEND_MODE       = 129, // kB mode - u8 , default=0
  930 
  931   CTX_MITER_LIMIT      = 130, // km limit - float, default = 0.0
  932 
  933   CTX_LINE_JOIN        = 131, // kj join - u8 , default=0
  934   CTX_LINE_CAP         = 132, // kc cap - u8, default = 0
  935   CTX_LINE_WIDTH       = 133, // kw width, default = 2.0
  936   CTX_GLOBAL_ALPHA     = 134, // ka alpha - default=1.0
  937   CTX_COMPOSITING_MODE = 135, // kc mode - u8 , default=0
  938 
  939   CTX_FONT_SIZE        = 136, // kf size - float, default=?
  940   CTX_TEXT_ALIGN       = 137, // kt align - u8, default = 
  941                          CTX_TEXT_ALIGN_START
  942   CTX_TEXT_BASELINE    = 138, // kb baseline - u8, default = 
  943                          CTX_TEXT_ALIGN_ALPHABETIC
  944   CTX_TEXT_DIRECTION   = 139, // kd
  945 
  946   CTX_SHADOW_BLUR      = 140, // ks
  947   CTX_SHADOW_COLOR     = 141, // kC
  948   CTX_SHADOW_OFFSET_X  = 142, // kx
  949   CTX_SHADOW_OFFSET_Y  = 143, // ky
  950   // items marked with % are currently only for the parser
  951   // for instance for svg compatibility or simulated/converted color spaces
  952   // not the serialization/internal render stream
  953 } CtxCode;
  954 
  955 
  956 #pragma pack(push,1)
  957 
  958 typedef struct _CtxCommand CtxCommand;
  959 typedef struct _CtxIterator CtxIterator;
  960 
  961 CtxIterator *
  962 ctx_current_path (Ctx *ctx);
  963 void
  964 ctx_path_extents (Ctx *ctx, float *ex1, float *ey1, float *ex2, float *ey2);
  965 
  966 #define CTX_ASSERT               0
  967 
  968 #if CTX_ASSERT==1
  969 #define ctx_assert(a)  if(!(a)){fprintf(stderr,"%s:%i assertion failed\n", 
  970                    __FUNCTION__, __LINE__);  }
  971 #else
  972 #define ctx_assert(a)
  973 #endif
  974 
  975 int ctx_get_drawlist_count (Ctx *ctx);
  976 
  977 struct
  978   _CtxCommand
  979 {
  980   union
  981   {
  982     uint8_t  code;
  983     CtxEntry entry;
  984     struct
  985     {
  986       uint8_t code;
  987       float scalex;
  988       float scaley;
  989     } scale;
  990     struct
  991     {
  992       uint8_t code;
  993       uint32_t stringlen;
  994       uint32_t blocklen;
  995       uint8_t cont;
  996       uint8_t data[8]; /* ... and continues */
  997     } data;
  998     struct
  999     {
 1000       uint8_t code;
 1001       uint32_t stringlen;
 1002       uint32_t blocklen;
 1003     } data_rev;
 1004     struct
 1005     {
 1006       uint8_t code;
 1007       float pad;
 1008       float pad2;
 1009       uint8_t code_data;
 1010       uint32_t stringlen;
 1011       uint32_t blocklen;
 1012       uint8_t code_cont;
 1013       uint8_t utf8[8]; /* .. and continues */
 1014     } text;
 1015     struct
 1016     {
 1017       uint8_t  code;
 1018       uint32_t key_hash;
 1019       float    pad;
 1020       uint8_t  code_data;
 1021       uint32_t stringlen;
 1022       uint32_t blocklen;
 1023       uint8_t  code_cont;
 1024       uint8_t  utf8[8]; /* .. and continues */
 1025     } set;
 1026     struct
 1027     {
 1028       uint8_t  code;
 1029       uint32_t pad0;
 1030       float    pad1;
 1031       uint8_t  code_data;
 1032       uint32_t stringlen;
 1033       uint32_t blocklen;
 1034       uint8_t  code_cont;
 1035       uint8_t  utf8[8]; /* .. and continues */
 1036     } get;
 1037     struct {
 1038       uint8_t  code;
 1039       uint32_t count; /* better than byte_len in code, but needs to then be 
 1040       set   */
 1041       float    pad1;
 1042       uint8_t  code_data;
 1043       uint32_t byte_len;
 1044       uint32_t blocklen;
 1045       uint8_t  code_cont;
 1046       float    data[2]; /* .. and - possibly continues */
 1047     } line_dash;
 1048     struct {
 1049       uint8_t  code;
 1050       uint32_t space_slot;
 1051       float    pad1;
 1052       uint8_t  code_data;
 1053       uint32_t data_len;
 1054       uint32_t blocklen;
 1055       uint8_t  code_cont;
 1056       uint8_t  data[8]; /* .. and continues */
 1057     } colorspace;
 1058     struct
 1059     {
 1060       uint8_t  code;
 1061       float    pad;
 1062       float    pad2;
 1063       uint8_t  code_data;
 1064       uint32_t stringlen;
 1065       uint32_t blocklen;
 1066       uint8_t  code_cont;
 1067       uint8_t  utf8[8]; /* .. and continues */
 1068     } text_stroke;
 1069     struct
 1070     {
 1071       uint8_t  code;
 1072       float    pad;
 1073       float    pad2;
 1074       uint8_t  code_data;
 1075       uint32_t stringlen;
 1076       uint32_t blocklen;
 1077       uint8_t  code_cont;
 1078       uint8_t  utf8[8]; /* .. and continues */
 1079     } set_font;
 1080     struct
 1081     {
 1082       uint8_t code;
 1083       float model;
 1084       float r;
 1085       uint8_t pad1;
 1086       float g;
 1087       float b;
 1088       uint8_t pad2;
 1089       float a;
 1090     } rgba;
 1091     struct
 1092     {
 1093       uint8_t code;
 1094       float model;
 1095       float c;
 1096       uint8_t pad1;
 1097       float m;
 1098       float y;
 1099       uint8_t pad2;
 1100       float k;
 1101       float a;
 1102     } cmyka;
 1103     struct
 1104     {
 1105       uint8_t code;
 1106       float model;
 1107       float g;
 1108       uint8_t pad1;
 1109       float a;
 1110     } graya;
 1111     struct
 1112     {
 1113       uint8_t code;
 1114       float model;
 1115       float c0;
 1116       uint8_t pad1;
 1117       float c1;
 1118       float c2;
 1119       uint8_t pad2;
 1120       float c3;
 1121       float c4;
 1122       uint8_t pad3;
 1123       float c5;
 1124       float c6;
 1125       uint8_t pad4;
 1126       float c7;
 1127       float c8;
 1128       uint8_t pad5;
 1129       float c9;
 1130       float c10;
 1131     } set_color;
 1132     struct
 1133     {
 1134       uint8_t code;
 1135       float x;
 1136       float y;
 1137     } rel_move_to;
 1138     struct
 1139     {
 1140       uint8_t code;
 1141       float x;
 1142       float y;
 1143     } rel_line_to;
 1144     struct
 1145     {
 1146       uint8_t code;
 1147       float x;
 1148       float y;
 1149     } line_to;
 1150     struct
 1151     {
 1152       uint8_t code;
 1153       float cx1;
 1154       float cy1;
 1155       uint8_t pad0;
 1156       float cx2;
 1157       float cy2;
 1158       uint8_t pad1;
 1159       float x;
 1160       float y;
 1161     } rel_curve_to;
 1162     struct
 1163     {
 1164       uint8_t code;
 1165       float x;
 1166       float y;
 1167     } move_to;
 1168     struct
 1169     {
 1170       uint8_t code;
 1171       float cx1;
 1172       float cy1;
 1173       uint8_t pad0;
 1174       float cx2;
 1175       float cy2;
 1176       uint8_t pad1;
 1177       float x;
 1178       float y;
 1179     } curve_to;
 1180     struct
 1181     {
 1182       uint8_t code;
 1183       float x1;
 1184       float y1;
 1185       uint8_t pad0;
 1186       float r1;
 1187       float x2;
 1188       uint8_t pad1;
 1189       float y2;
 1190       float r2;
 1191     } radial_gradient;
 1192     struct
 1193     {
 1194       uint8_t code;
 1195       float x1;
 1196       float y1;
 1197       uint8_t pad0;
 1198       float x2;
 1199       float y2;
 1200     } linear_gradient;
 1201     struct
 1202     {
 1203       uint8_t code;
 1204       float x;
 1205       float y;
 1206       uint8_t pad0;
 1207       float width;
 1208       float height;
 1209       uint8_t pad1;
 1210       float radius;
 1211     } rectangle;
 1212 
 1213     struct
 1214     {
 1215       uint8_t code;
 1216       uint16_t glyph_before;
 1217       uint16_t glyph_after;
 1218        int32_t amount;
 1219     } kern;
 1220 
 1221     struct
 1222     {
 1223       uint8_t code;
 1224       uint32_t glyph;
 1225       uint32_t advance; // * 256
 1226     } define_glyph;
 1227 
 1228     struct
 1229     {
 1230       uint8_t code;
 1231       uint8_t rgba[4];
 1232       uint16_t x;
 1233       uint16_t y;
 1234     } set_pixel;
 1235     struct
 1236     {
 1237       uint8_t code;
 1238       float cx;
 1239       float cy;
 1240       uint8_t pad0;
 1241       float x;
 1242       float y;
 1243     } quad_to;
 1244     struct
 1245     {
 1246       uint8_t code;
 1247       float cx;
 1248       float cy;
 1249       uint8_t pad0;
 1250       float x;
 1251       float y;
 1252     } rel_quad_to;
 1253     struct
 1254     {
 1255       uint8_t code;
 1256       float x;
 1257       float y;
 1258       uint8_t pad0;
 1259       float radius;
 1260       float angle1;
 1261       uint8_t pad1;
 1262       float angle2;
 1263       float direction;
 1264     }
 1265     arc;
 1266     struct
 1267     {
 1268       uint8_t code;
 1269       float x1;
 1270       float y1;
 1271       uint8_t pad0;
 1272       float x2;
 1273       float y2;
 1274       uint8_t pad1;
 1275       float radius;
 1276     }
 1277     arc_to;
 1278     /* some format specific generic accesors:  */
 1279     struct
 1280     {
 1281       uint8_t code;
 1282       float   x0;
 1283       float   y0;
 1284       uint8_t pad0;
 1285       float   x1;
 1286       float   y1;
 1287       uint8_t pad1;
 1288       float   x2;
 1289       float   y2;
 1290       uint8_t pad2;
 1291       float   x3;
 1292       float   y3;
 1293       uint8_t pad3;
 1294       float   x4;
 1295       float   y4;
 1296     } c;
 1297     struct
 1298     {
 1299       uint8_t code;
 1300       float   a0;
 1301       float   a1;
 1302       uint8_t pad0;
 1303       float   a2;
 1304       float   a3;
 1305       uint8_t pad1;
 1306       float   a4;
 1307       float   a5;
 1308       uint8_t pad2;
 1309       float   a6;
 1310       float   a7;
 1311       uint8_t pad3;
 1312       float   a8;
 1313       float   a9;
 1314     } f;
 1315     struct
 1316     {
 1317       uint8_t  code;
 1318       uint32_t a0;
 1319       uint32_t a1;
 1320       uint8_t  pad0;
 1321       uint32_t a2;
 1322       uint32_t a3;
 1323       uint8_t  pad1;
 1324       uint32_t a4;
 1325       uint32_t a5;
 1326       uint8_t  pad2;
 1327       uint32_t a6;
 1328       uint32_t a7;
 1329       uint8_t  pad3;
 1330       uint32_t a8;
 1331       uint32_t a9;
 1332     } u32;
 1333     struct
 1334     {
 1335       uint8_t  code;
 1336       uint64_t a0;
 1337       uint8_t  pad0;
 1338       uint64_t a1;
 1339       uint8_t  pad1;
 1340       uint64_t a2;
 1341       uint8_t  pad2;
 1342       uint64_t a3;
 1343       uint8_t  pad3;
 1344       uint64_t a4;
 1345     } u64;
 1346     struct
 1347     {
 1348       uint8_t code;
 1349       int32_t a0;
 1350       int32_t a1;
 1351       uint8_t pad0;
 1352       int32_t a2;
 1353       int32_t a3;
 1354       uint8_t pad1;
 1355       int32_t a4;
 1356       int32_t a5;
 1357       uint8_t pad2;
 1358       int32_t a6;
 1359       int32_t a7;
 1360       uint8_t pad3;
 1361       int32_t a8;
 1362       int32_t a9;
 1363     } s32;
 1364     struct
 1365     {
 1366       uint8_t code;
 1367       int16_t a0;
 1368       int16_t a1;
 1369       int16_t a2;
 1370       int16_t a3;
 1371       uint8_t pad0;
 1372       int16_t a4;
 1373       int16_t a5;
 1374       int16_t a6;
 1375       int16_t a7;
 1376       uint8_t pad1;
 1377       int16_t a8;
 1378       int16_t a9;
 1379       int16_t a10;
 1380       int16_t a11;
 1381       uint8_t pad2;
 1382       int16_t a12;
 1383       int16_t a13;
 1384       int16_t a14;
 1385       int16_t a15;
 1386       uint8_t pad3;
 1387       int16_t a16;
 1388       int16_t a17;
 1389       int16_t a18;
 1390       int16_t a19;
 1391     } s16;
 1392     struct
 1393     {
 1394       uint8_t code;
 1395       uint16_t a0;
 1396       uint16_t a1;
 1397       uint16_t a2;
 1398       uint16_t a3;
 1399       uint8_t pad0;
 1400       uint16_t a4;
 1401       uint16_t a5;
 1402       uint16_t a6;
 1403       uint16_t a7;
 1404       uint8_t pad1;
 1405       uint16_t a8;
 1406       uint16_t a9;
 1407       uint16_t a10;
 1408       uint16_t a11;
 1409       uint8_t pad2;
 1410       uint16_t a12;
 1411       uint16_t a13;
 1412       uint16_t a14;
 1413       uint16_t a15;
 1414       uint8_t pad3;
 1415       uint16_t a16;
 1416       uint16_t a17;
 1417       uint16_t a18;
 1418       uint16_t a19;
 1419     } u16;
 1420     struct
 1421     {
 1422       uint8_t code;
 1423       uint8_t a0;
 1424       uint8_t a1;
 1425       uint8_t a2;
 1426       uint8_t a3;
 1427       uint8_t a4;
 1428       uint8_t a5;
 1429       uint8_t a6;
 1430       uint8_t a7;
 1431       uint8_t pad0;
 1432       uint8_t a8;
 1433       uint8_t a9;
 1434       uint8_t a10;
 1435       uint8_t a11;
 1436       uint8_t a12;
 1437       uint8_t a13;
 1438       uint8_t a14;
 1439       uint8_t a15;
 1440       uint8_t pad1;
 1441       uint8_t a16;
 1442       uint8_t a17;
 1443       uint8_t a18;
 1444       uint8_t a19;
 1445       uint8_t a20;
 1446       uint8_t a21;
 1447       uint8_t a22;
 1448       uint8_t a23;
 1449     } u8;
 1450     struct
 1451     {
 1452       uint8_t code;
 1453       int8_t a0;
 1454       int8_t a1;
 1455       int8_t a2;
 1456       int8_t a3;
 1457       int8_t a4;
 1458       int8_t a5;
 1459       int8_t a6;
 1460       int8_t a7;
 1461       uint8_t pad0;
 1462       int8_t a8;
 1463       int8_t a9;
 1464       int8_t a10;
 1465       int8_t a11;
 1466       int8_t a12;
 1467       int8_t a13;
 1468       int8_t a14;
 1469       int8_t a15;
 1470       uint8_t pad1;
 1471       int8_t a16;
 1472       int8_t a17;
 1473       int8_t a18;
 1474       int8_t a19;
 1475       int8_t a20;
 1476       int8_t a21;
 1477       int8_t a22;
 1478       int8_t a23;
 1479     } s8;
 1480   };
 1481   CtxEntry next_entry; // also pads size of CtxCommand slightly.
 1482 };
 1483 
 1484 typedef struct _CtxImplementation CtxImplementation;
 1485 struct _CtxImplementation
 1486 {
 1487   void (*process)        (void *renderer, CtxCommand *entry);
 1488   void (*reset)          (void *renderer);
 1489   void (*flush)          (void *renderer);
 1490   char *(*get_clipboard) (void *ctxctx);
 1491   void (*set_clipboard)  (void *ctxctx, const char *text);
 1492   void (*free)           (void *renderer);
 1493 };
 1494 
 1495 CtxCommand *ctx_iterator_next (CtxIterator *iterator);
 1496 
 1497 #define ctx_arg_string()  ((char*)&entry[2].data.u8[0])
 1498 
 1499 
 1500 /* The above should be public API
 1501  */
 1502 
 1503 #pragma pack(pop)
 1504 
 1505 /* access macros for nth argument of a given type when packed into
 1506  * an CtxEntry pointer in current code context
 1507  */
 1508 #define ctx_arg_float(no) entry[(no)>>1].data.f[(no)&1]
 1509 #define ctx_arg_u64(no)   entry[(no)].data.u64[0]
 1510 #define ctx_arg_u32(no)   entry[(no)>>1].data.u32[(no)&1]
 1511 #define ctx_arg_s32(no)   entry[(no)>>1].data.s32[(no)&1]
 1512 #define ctx_arg_u16(no)   entry[(no)>>2].data.u16[(no)&3]
 1513 #define ctx_arg_s16(no)   entry[(no)>>2].data.s16[(no)&3]
 1514 #define ctx_arg_u8(no)    entry[(no)>>3].data.u8[(no)&7]
 1515 #define ctx_arg_s8(no)    entry[(no)>>3].data.s8[(no)&7]
 1516 #define ctx_arg_string()  ((char*)&entry[2].data.u8[0])
 1517 
 1518 typedef enum
 1519 {
 1520   CTX_GRAY           = 1,
 1521   CTX_RGB            = 3,
 1522   CTX_DRGB           = 4,
 1523   CTX_CMYK           = 5,
 1524   CTX_DCMYK          = 6,
 1525   CTX_LAB            = 7,
 1526   CTX_LCH            = 8,
 1527   CTX_GRAYA          = 101,
 1528   CTX_RGBA           = 103,
 1529   CTX_DRGBA          = 104,
 1530   CTX_CMYKA          = 105,
 1531   CTX_DCMYKA         = 106,
 1532   CTX_LABA           = 107,
 1533   CTX_LCHA           = 108,
 1534   CTX_GRAYA_A        = 201,
 1535   CTX_RGBA_A         = 203,
 1536   CTX_RGBA_A_DEVICE  = 204,
 1537   CTX_CMYKA_A        = 205,
 1538   CTX_DCMYKA_A       = 206,
 1539   // RGB  device and  RGB  ?
 1540 } CtxColorModel;
 1541 
 1542 enum _CtxAntialias
 1543 {
 1544   CTX_ANTIALIAS_DEFAULT,
 1545   CTX_ANTIALIAS_NONE, // non-antialiased
 1546   CTX_ANTIALIAS_FAST, // aa 3
 1547   CTX_ANTIALIAS_GOOD, // aa 5
 1548   CTX_ANTIALIAS_BEST  // aa 17
 1549 };
 1550 typedef enum _CtxAntialias CtxAntialias;
 1551 
 1552 enum _CtxCursor
 1553 {
 1554   CTX_CURSOR_UNSET,
 1555   CTX_CURSOR_NONE,
 1556   CTX_CURSOR_ARROW,
 1557   CTX_CURSOR_IBEAM,
 1558   CTX_CURSOR_WAIT,
 1559   CTX_CURSOR_HAND,
 1560   CTX_CURSOR_CROSSHAIR,
 1561   CTX_CURSOR_RESIZE_ALL,
 1562   CTX_CURSOR_RESIZE_N,
 1563   CTX_CURSOR_RESIZE_S,
 1564   CTX_CURSOR_RESIZE_E,
 1565   CTX_CURSOR_RESIZE_NE,
 1566   CTX_CURSOR_RESIZE_SE,
 1567   CTX_CURSOR_RESIZE_W,
 1568   CTX_CURSOR_RESIZE_NW,
 1569   CTX_CURSOR_RESIZE_SW,
 1570   CTX_CURSOR_MOVE
 1571 };
 1572 typedef enum _CtxCursor CtxCursor;
 1573 
 1574 /* to be used immediately after a ctx_listen or ctx_listen_full causing the
 1575  * cursor to change when hovering the listen area.
 1576  */
 1577 void ctx_listen_set_cursor (Ctx      *ctx,
 1578                             CtxCursor cursor);
 1579 
 1580 /* lower level cursor setting that is independent of ctx event handling
 1581  */
 1582 void         ctx_set_cursor (Ctx *ctx, CtxCursor cursor);
 1583 CtxCursor    ctx_get_cursor (Ctx *ctx);
 1584 void         ctx_set_antialias (Ctx *ctx, CtxAntialias antialias);
 1585 CtxAntialias ctx_get_antialias (Ctx *ctx);
 1586 void         ctx_set_render_threads   (Ctx *ctx, int n_threads);
 1587 int          ctx_get_render_threads   (Ctx *ctx);
 1588 
 1589 void         ctx_set_hash_cache (Ctx *ctx, int enable_hash_cache);
 1590 int          ctx_get_hash_cache (Ctx *ctx);
 1591 
 1592 
 1593 typedef struct _CtxParser CtxParser;
 1594   CtxParser *ctx_parser_new (
 1595   Ctx       *ctx,
 1596   int        width,
 1597   int        height,
 1598   float      cell_width,
 1599   float      cell_height,
 1600   int        cursor_x,
 1601   int        cursor_y,
 1602   int   (*set_prop)(void *prop_data, uint32_t key, const char *data,  int 
 1603          len),
 1604   int   (*get_prop)(void *prop_Data, const char *key, char **data, int *len)
 1605          ,
 1606   void  *prop_data,
 1607   void (*exit) (void *exit_data),
 1608   void *exit_data);
 1609 
 1610 
 1611 enum _CtxColorSpace
 1612 {
 1613   CTX_COLOR_SPACE_DEVICE_RGB,
 1614   CTX_COLOR_SPACE_DEVICE_CMYK,
 1615   CTX_COLOR_SPACE_USER_RGB,
 1616   CTX_COLOR_SPACE_USER_CMYK,
 1617 };
 1618 typedef enum _CtxColorSpace CtxColorSpace;
 1619 
 1620 void ctx_colorspace (Ctx           *ctx,
 1621                      CtxColorSpace  space_slot,
 1622                      unsigned char *data,
 1623                      int            data_length);
 1624 
 1625 void
 1626 ctx_parser_set_size (CtxParser *parser,
 1627                      int        width,
 1628                      int        height,
 1629                      float      cell_width,
 1630                      float      cell_height);
 1631 
 1632 void ctx_parser_feed_byte (CtxParser *parser, int byte);
 1633 
 1634 void ctx_parser_free (CtxParser *parser);
 1635 
 1636 #ifndef CTX_CODEC_CHAR
 1637 //#define CTX_CODEC_CHAR '\035'
 1638 //#define CTX_CODEC_CHAR 'a'
 1639 #define CTX_CODEC_CHAR '\077'
 1640 //#define CTX_CODEC_CHAR '^'
 1641 #endif
 1642 
 1643 #ifndef assert
 1644 #define assert(a)
 1645 #endif
 1646 
 1647 #ifdef __cplusplus
 1648 }
 1649 #endif
 1650 #endif
 1651 #ifndef __CTX_H__
 1652 #define __CTX_H__
 1653 /* mrg - MicroRaptor Gui
 1654  * Copyright (c) 2014 Øyvind Kolås <pippin@hodefoting.com>
 1655  *
 1656  * This library is free software; you can redistribute it and/or
 1657  * modify it under the terms of the GNU Lesser General Public
 1658  * License as published by the Free Software Foundation; either
 1659  * version 2 of the License, or (at your option) any later version.
 1660  *
 1661  * This library is distributed in the hope that it will be useful,
 1662  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 1663  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 1664  * Lesser General Public License for more details.
 1665  *
 1666  * You should have received a copy of the GNU Lesser General Public
 1667  * License along with this library. If not, see <http://www.gnu.
 1668  org/licenses/>.
 1669  */
 1670 
 1671 #ifndef CTX_STRING_H
 1672 #define CTX_STRING_H
 1673 
 1674 typedef struct _CtxString CtxString;
 1675 struct _CtxString
 1676 {
 1677   char *str;
 1678   int   length;
 1679   int   utf8_length;
 1680   int   allocated_length;
 1681   int   is_line;
 1682 };
 1683 
 1684 CtxString   *ctx_string_new_with_size  (const char *initial, int 
 1685                                         initial_size);
 1686 CtxString   *ctx_string_new            (const char *initial);
 1687 void        ctx_string_free           (CtxString *string, int freealloc);
 1688 const char *ctx_string_get            (CtxString *string);
 1689 uint32_t    ctx_string_get_unichar    (CtxString *string, int pos);
 1690 int         ctx_string_get_length     (CtxString *string);
 1691 void        ctx_string_set            (CtxString *string, const char 
 1692                                        *new_string);
 1693 void        ctx_string_clear          (CtxString *string);
 1694 void        ctx_string_append_str     (CtxString *string, const char *str);
 1695 void        ctx_string_append_byte    (CtxString *string, char  val);
 1696 void        ctx_string_append_string  (CtxString *string, CtxString 
 1697                                        *string2);
 1698 void        ctx_string_append_unichar (CtxString *string, unsigned int 
 1699                                        unichar);
 1700 void        ctx_string_append_data    (CtxString *string, const char *data, 
 1701                                        int len);
 1702 
 1703 void        ctx_string_append_utf8char (CtxString *string, const char *str);
 1704 void        ctx_string_append_printf  (CtxString *string, const char 
 1705                                        *format, ...);
 1706 void        ctx_string_replace_utf8   (CtxString *string, int pos, const 
 1707                                        char *new_glyph);
 1708 void        ctx_string_insert_utf8    (CtxString *string, int pos, const 
 1709                                        char *new_glyph);
 1710 void        ctx_string_replace_unichar (CtxString *string, int pos, 
 1711                                         uint32_t unichar);
 1712 void        ctx_string_remove         (CtxString *string, int pos);
 1713 
 1714 #ifndef TRUE
 1715 #define TRUE 1
 1716 #endif
 1717 #ifndef FALSE
 1718 #define FALSE 0
 1719 #endif
 1720 
 1721 #endif
 1722  /* Copyright (C) 2020 Øyvind Kolås <pippin@gimp.org>
 1723  */
 1724 
 1725 #if CTX_FORMATTER
 1726 
 1727 /* returns the maximum string length including terminating \0 */
 1728 static int ctx_a85enc_len (int input_length)
 1729 {
 1730   return (input_length / 4 + 1) * 5;
 1731 }
 1732 
 1733 static int ctx_a85enc (const void *srcp, char *dst, int count)
 1734 {
 1735   const uint8_t *src = (uint8_t*)srcp;
 1736   int out_len = 0;
 1737 
 1738   int padding = 4-(count % 4);
 1739   if (padding == 4) padding = 0;
 1740 
 1741   for (int i = 0; i < (count+3)/4; i ++)
 1742   {
 1743     uint32_t input = 0;
 1744     for (int j = 0; j < 4; j++)
 1745     {
 1746       input = (input << 8);
 1747       if (i*4+j<=count)
 1748         input += src[i*4+j];
 1749     }
 1750 
 1751     int divisor = 85 * 85 * 85 * 85;
 1752     if (input == 0)
 1753     {
 1754         dst[out_len++] = 'z';
 1755     }
 1756     /* todo: encode 4 spaces as 'y' */
 1757     else
 1758     {
 1759       for (int j = 0; j < 5; j++)
 1760       {
 1761         dst[out_len++] = ((input / divisor) % 85) + '!';
 1762         divisor /= 85;
 1763       }
 1764     }
 1765   }
 1766   out_len -= padding;
 1767   dst[out_len]=0;
 1768   return out_len;
 1769 }
 1770 #endif
 1771 
 1772 #if CTX_PARSER
 1773 
 1774 static int ctx_a85dec (const char *src, char *dst, int count)
 1775 {
 1776   int out_len = 0;
 1777   uint32_t val = 0;
 1778   int k = 0;
 1779   int i = 0;
 1780   for (i = 0; i < count; i ++)
 1781   {
 1782     val *= 85;
 1783     if (src[i] == '~')
 1784     {
 1785       break;
 1786     }
 1787     else if (src[i] == 'z')
 1788     {
 1789       for (int j = 0; j < 4; j++)
 1790         dst[out_len++] = 0;
 1791       k = 0;
 1792     }
 1793     else if (src[i] == 'y') /* lets support this extension */
 1794     {
 1795       for (int j = 0; j < 4; j++)
 1796         dst[out_len++] = 32;
 1797       k = 0;
 1798     }
 1799     else if (src[i] >= '!' && src[i] <= 'u')
 1800     {
 1801       val += src[i]-'!';
 1802       if (k % 5 == 4)
 1803       {
 1804          for (int j = 0; j < 4; j++)
 1805          {
 1806            dst[out_len++] = (val & (0xff << 24)) >> 24;
 1807            val <<= 8;
 1808          }
 1809          val = 0;
 1810       }
 1811       k++;
 1812     }
 1813     // we treat all other chars as whitespace
 1814   }
 1815   if (src[i] != '~')
 1816   { 
 1817     val *= 85;
 1818   }
 1819   k = k % 5;
 1820   if (k)
 1821   {
 1822     val += 84;
 1823     for (int j = k; j < 4; j++)
 1824     {
 1825       val *= 85;
 1826       val += 84;
 1827     }
 1828 
 1829     for (int j = 0; j < k-1; j++)
 1830     {
 1831       dst[out_len++] = (val & (0xff << 24)) >> 24;
 1832       val <<= 8;
 1833     }
 1834     val = 0;
 1835   }
 1836   dst[out_len] = 0;
 1837   return out_len;
 1838 }
 1839 
 1840 #if 0
 1841 static int ctx_a85len (const char *src, int count)
 1842 {
 1843   int out_len = 0;
 1844   int k = 0;
 1845   for (int i = 0; i < count; i ++)
 1846   {
 1847     if (src[i] == '~')
 1848       break;
 1849     else if (src[i] == 'z')
 1850     {
 1851       for (int j = 0; j < 4; j++)
 1852         out_len++;
 1853       k = 0;
 1854     }
 1855     else if (src[i] >= '!' && src[i] <= 'u')
 1856     {
 1857       if (k % 5 == 4)
 1858         out_len += 4;
 1859       k++;
 1860     }
 1861     // we treat all other chars as whitespace
 1862   }
 1863   k = k % 5;
 1864   if (k)
 1865     out_len += k-1;
 1866   return out_len;
 1867 }
 1868 #endif
 1869 
 1870 #endif
 1871 #ifndef _CTX_INTERNAL_FONT_
 1872 #define _CTX_INTERNAL_FONT_
 1873 
 1874 #ifndef CTX_FONT_ascii
 1875 /* this is a ctx encoded font based on DejaVuSans.ttf */
 1876 /* CTX_SUBDIV:4  CTX_BAKE_FONT_SIZE:160 */
 1877 /* glyphs covered: 
 1878 
 1879  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghi
 1880   jklmnopqrstuvwxyz{|}~  */
 1881 static const struct __attribute__ ((packed)) {uint8_t code; uint32_t a; 
 1882                                    uint32_t b;}
 1883 ctx_font_ascii[]={
 1884 {'@', 0x00000020, 0x00002bb0},/*                 x-advance: 43.687500 */
 1885 {'@', 0x00000021, 0x00003719},/*        !        x-advance: 55.097656 */
 1886 {'M', 0x41a5e7f2, 0xc1886037},
 1887 {'0', 0x44000036, 0xbc0000ca},
 1888 {'m', 0x00000000, 0xc2a64f08},
 1889 {'l', 0x4159fc90, 0x00000000},
 1890 {'l', 0x00000000, 0x422fd6c4},
 1891 {'l', 0xbfabcfe0, 0x41bfad86},
 1892 {'l', 0xc12df5b2, 0x00000000},
 1893 {'l', 0xbfb46710, 0xc1bfad86},
 1894 {'l', 0x00000000, 0xc22fd6c4},
 1895 {'@', 0x00000022, 0x00003f38},/*        "        x-advance: 63.218750 */
 1896 {'M', 0x41c50c07, 0xc2c86716},
 1897 {'l', 0x00000000, 0x4214fe48},
 1898 {'4', 0x0000ffd3, 0xff6c0000},
 1899 {'6', 0x0000002d, 0x00000065},
 1900 {'l', 0x00000000, 0x4214fe48},
 1901 {'l', 0xc1368ce4, 0x00000000},
 1902 {'l', 0x00000000, 0xc214fe48},
 1903 {'l', 0x41368ce4, 0x00000000},
 1904 {'@', 0x00000023, 0x0000732a},/*        #        x-advance: 115.164062 */
 1905 {'M', 0x428c8973, 0xc271e113},
 1906 {'0', 0x59ea00b2, 0xa716004e},
 1907 {'m', 0xc12112e8, 0xc218c06d},
 1908 {'0', 0x004e6fe5, 0x002a911c},
 1909 {'0', 0x00536fe5, 0x00a22900},
 1910 {'0', 0x005559ea, 0x00a12900},
 1911 {'0', 0x00d66fe5, 0x00b2911b},
 1912 {'0', 0x00d56fe5, 0x00ac911b},
 1913 {'0', 0x005ed700, 0x00aaa716},
 1914 {'0', 0x0060d700, 0x002b911b},
 1915 {'@', 0x00000024, 0x00005773},/*        $        x-advance: 87.449219 */
 1916 {'M', 0x4239c595, 0x41a19c59},
 1917 {'4', 0x0000ffe6, 0xffb00000},
 1918 {'8', 0xfac800e4, 0xeec8fae4},
 1919 {'l', 0x00000000, 0xc14149e1},
 1920 {'8', 0x1a37111b, 0x0839081c},
 1921 {'l', 0x00000000, 0xc1f4d50c},
 1922 {'8', 0xe0aaf7c5, 0xc1e6e9e6},
 1923 {'8', 0xbc1dd500, 0xe454e71d},
 1924 {'4', 0xffc10000, 0x0000001a},
 1925 {'l', 0x00000000, 0x417920a8},
 1926 {'8', 0x05300118, 0x0b2d0417},
 1927 {'l', 0x00000000, 0x413beb60},
 1928 {'8', 0xefd3f5ea, 0xf9d0fae9},
 1929 {'l', 0x00000000, 0x41e54302},
 1930 {'8', 0x2159093c, 0x421c181c},
 1931 {'8', 0x47e22d00, 0x1ea91ae2},
 1932 {'6', 0x00510000, 0xfee1ffe6},
 1933 {'l', 0x00000000, 0xc1dc2258},
 1934 {'8', 0x11d103e1, 0x25f00ef0},
 1935 {'8', 0x230f1700, 0x12300c0f},
 1936 {'m', 0x40d6c3d8, 0x414e2cac},
 1937 {'l', 0x00000000, 0x41e87bb4},
 1938 {'8', 0xed33fc22, 0xda11f211},
 1939 {'8', 0xdbf0e900, 0xecccf3f0},
 1940 {'@', 0x00000025, 0x0000829a},/*        %        x-advance: 130.601562 */
 1941 {'M', 0x42c7dda3, 0xc2306037},
 1942 {'8', 0x13dc00e9, 0x37f313f3},
 1943 {'8', 0x370d2200, 0x1324130d},
 1944 {'8', 0xed230016, 0xc90dec0d},
 1945 {'8', 0xc9f3dd00, 0xecddecf3},
 1946 {'m', 0x00000000, 0xc1086034},
 1947 {'8', 0x1d43002a, 0x4f181d18},
 1948 {'8', 0x4fe73200, 0x1dbd1de8},
 1949 {'8', 0xe3bd00d6, 0xb1e8e3e8},
 1950 {'8', 0xb118ce00, 0xe343e319},
 1951 {'m', 0xc28a8603, 0xc2237d6c},
 1952 {'8', 0x14dc00e9, 0x36f313f3},
 1953 {'8', 0x370d2300, 0x1324130d},
 1954 {'8', 0xed240017, 0xc90ded0d},
 1955 {'8', 0xcaf3de00, 0xecdcecf3},
 1956 {'m', 0x42726a86, 0xc1086038},
 1957 {'l', 0x412bcfe0, 0x00000000},
 1958 {'4', 0x019fff06, 0x0000ffd6},
 1959 {'6', 0xfe6100fa, 0x0000ff0e},
 1960 {'8', 0x1d43002a, 0x4f191d19},
 1961 {'8', 0x50e73200, 0x1dbd1de8},
 1962 {'8', 0xe3bd00d6, 0xb0e8e3e8},
 1963 {'8', 0xb118cf00, 0xe343e318},
 1964 {'@', 0x00000026, 0x00006b2e},/*        &        x-advance: 107.179688 */
 1965 {'M', 0x4205b0f7, 0xc257920a},
 1966 {'8', 0x2bdd15e8, 0x2df515f5},
 1967 {'8', 0x411c2700, 0x1a471a1c},
 1968 {'8', 0xf82f0019, 0xe729f816},
 1969 {'6', 0xff6fff72, 0xffe20025},
 1970 {'l', 0x42086037, 0x420b98e9},
 1971 {'8', 0xcd18e90f, 0xc70ae508},
 1972 {'l', 0x4147bb40, 0x00000000},
 1973 {'8', 0x46ef23fd, 0x44da22f3},
 1974 {'4', 0x004c004a, 0x0000ffbd},
 1975 {'l', 0xc1198e98, 0xc11dda33},
 1976 {'8', 0x23c617e5, 0x0bbf0be2},
 1977 {'8', 0xdc9700c0, 0xa2d7dbd7},
 1978 {'8', 0xc011de00, 0xc835e211},
 1979 {'8', 0xdfedf0f4, 0xdffaf0fa},
 1980 {'8', 0xbb1dd500, 0xe64fe61d},
 1981 {'8', 0x042c0016, 0x0e2d0416},
 1982 {'l', 0x00000000, 0x41436fb0},
 1983 {'8', 0xedd4f4e9, 0xfad9faeb},
 1984 {'8', 0x0fd300e4, 0x26ef0eef},
 1985 {'8', 0x1b070d00, 0x26200d08},
 1986 {'@', 0x00000027, 0x000025c9},/*        '        x-advance: 37.785156 */
 1987 {'M', 0x41c50c07, 0xc2c86716},
 1988 {'l', 0x00000000, 0x4214fe48},
 1989 {'l', 0xc1368ce3, 0x00000000},
 1990 {'l', 0x00000000, 0xc214fe48},
 1991 {'l', 0x41368ce3, 0x00000000},
 1992 {'@', 0x00000028, 0x0000359f},/*        (        x-advance: 53.621094 */
 1993 {'M', 0x422a7844, 0xc2d09732},
 1994 {'q', 0xc10fe480, 0x4176fae0},
 1995 {0, 0xc155b0f6, 0x41f44b9c},
 1996 {'q', 0xc08b98e8, 0x41719c54},
 1997 {0, 0xc08b98e8, 0x41f4d50a},
 1998 {'q', 0x00000000, 0x41780dbe},
 1999 {0, 0x408b98e8, 0x41f5e7f2},
 2000 {'9', 0x003c0011, 0x007a0035},
 2001 {'l', 0xc12bcfe2, 0x00000000},
 2002 {'q', 0xc12112e6, 0xc17c5958},
 2003 {0, 0xc1719c5a, 0xc1f80dbf},
 2004 {'q', 0xc09eed18, 0xc173c224},
 2005 {0, 0xc09eed18, 0xc1f225cc},
 2006 {'q', 0x00000000, 0xc16f768c},
 2007 {0, 0x409eed18, 0xc1f112e6},
 2008 {'q', 0x409eed1c, 0xc172af40},
 2009 {0, 0x41719c5a, 0xc1f80dc0},
 2010 {'l', 0x412bcfe2, 0x00000000},
 2011 {'@', 0x00000029, 0x0000359f},/*        )        x-advance: 53.621094 */
 2012 {'M', 0x41301b7d, 0xc2d09732},
 2013 {'l', 0x412bcfe5, 0x00000000},
 2014 {'q', 0x412112e6, 0x417d6c40},
 2015 {0, 0x41708972, 0x41f80dc0},
 2016 {'q', 0x40a112e8, 0x4172af40},
 2017 {0, 0x40a112e8, 0x41f112e6},
 2018 {'q', 0x00000000, 0x41708974},
 2019 {0, 0xc0a112e8, 0x41f225cc},
 2020 {'9', 0x003cffed, 0x007cffc4},
 2021 {'l', 0xc12bcfe5, 0x00000000},
 2022 {'q', 0x410ed19d, 0xc175e7f3},
 2023 {0, 0x41549e11, 0xc1f44b99},
 2024 {'q', 0x408dbeb4, 0xc173c226},
 2025 {0, 0x408dbeb4, 0xc1f5e7f2},
 2026 {'q', 0x00000000, 0xc1780dc0},
 2027 {0, 0xc08dbeb4, 0xc1f4d50a},
 2028 {'q', 0xc08b98e8, 0xc1719c58},
 2029 {0, 0xc1549e11, 0xc1f44b9c},
 2030 {'@', 0x0000002a, 0x000044b9},/*        *        x-advance: 68.722656 */
 2031 {'M', 0x42814302, 0xc2a761ef},
 2032 {'0', 0x346034a0, 0xcaa61af1},
 2033 {'0', 0x00e26500, 0x36a69b00},
 2034 {'0', 0xcc60e6f1, 0xe60fcca0},
 2035 {'0', 0x9b00365a, 0x6500001e},
 2036 {'l', 0x41b46716, 0xc159fc90},
 2037 {'l', 0x407920b0, 0x40d49e10},
 2038 {'@', 0x0000002b, 0x0000732a},/*        +        x-advance: 115.164062 */
 2039 {'M', 0x427ce2ca, 0xc2ac5957},
 2040 {'l', 0x00000000, 0x421587ba},
 2041 {'l', 0x421587bc, 0x00000000},
 2042 {'l', 0x00000000, 0x41368ce4},
 2043 {'l', 0xc21587bc, 0x00000000},
 2044 {'l', 0x00000000, 0x421587bb},
 2045 {'l', 0xc1346714, 0x00000000},
 2046 {'l', 0x00000000, 0xc21587bb},
 2047 {'l', 0xc21587bb, 0x00000000},
 2048 {'l', 0xb5800000, 0xc1368ce4},
 2049 {'l', 0x421587bb, 0x00000000},
 2050 {'l', 0x00000000, 0xc21587ba},
 2051 {'l', 0x41346714, 0x00000000},
 2052 {'@', 0x0000002c, 0x00002bb0},/*        ,        x-advance: 43.687500 */
 2053 {'M', 0x4180dbeb, 0xc1886037},
 2054 {'0', 0x2e000038, 0x00de55d4},
 2055 {'l', 0x40b01b7c, 0xc1abcfe4},
 2056 {'l', 0x00000000, 0xc138b2b0},
 2057 {'@', 0x0000002d, 0x00003198},/*        -        x-advance: 49.593750 */
 2058 {'M', 0x40d6c3dd, 0xc22c9e11},
 2059 {'l', 0x4210b2af, 0x00000000},
 2060 {'l', 0x00000000, 0x41301b7c},
 2061 {'l', 0xc210b2af, 0x00000000},
 2062 {'l', 0xb5c00000, 0xc1301b7c},
 2063 {'[', 0x0047002d, 0x00000508},
 2064 {'[', 0x004a002d, 0x000007a6},
 2065 {'[', 0x004f002d, 0x000003d3},
 2066 {'[', 0x0051002d, 0x00000508},
 2067 {'[', 0x006f002d, 0x0000028c},
 2068 {'@', 0x0000002e, 0x00002bb0},/*        .        x-advance: 43.687500 */
 2069 {'M', 0x416b2af4, 0xc1886037},
 2070 {'0', 0x44000038, 0xbc0000c8},
 2071 {'@', 0x0000002f, 0x00002e4f},/*        /        x-advance: 46.308594 */
 2072 {'M', 0x420b98e9, 0xc2c86716},
 2073 {'l', 0x41368ce4, 0x00000000},
 2074 {'l', 0xc20b98e9, 0x42e1e7f2},
 2075 {'l', 0xc1368ce4, 0xb5800000},
 2076 {'l', 0x420b98e9, 0xc2e1e7f2},
 2077 {'@', 0x00000030, 0x00005773},/*        0        x-advance: 87.449219 */
 2078 {'M', 0x422ec3dd, 0xc2b68ce3},
 2079 {'q', 0xc1278448, 0x00000000},
 2080 {0, 0xc17c5956, 0x41255e80},
 2081 {'q', 0xc0a7844c, 0x41244b98},
 2082 {0, 0xc0a7844c, 0x41f7844c},
 2083 {'q', 0x00000000, 0x41a4d50c},
 2084 {0, 0x40a7844c, 0x41f7844c},
 2085 {'8', 0x293f2915, 0xd73f002a},
 2086 {'q', 0x40a9aa18, 0xc1255e80},
 2087 {0, 0x40a9aa18, 0xc1f7844c},
 2088 {'q', 0x00000000, 0xc1a55e80},
 2089 {0, 0xc0a9aa18, 0xc1f7844c},
 2090 {'9', 0xffd7ffec, 0xffd7ffc1},
 2091 {'m', 0x00000000, 0xc12bcfe0},
 2092 {'q', 0x4186c3de, 0x00000000},
 2093 {0, 0x41cda33a, 0x4155b0f8},
 2094 {'q', 0x410ed198, 0x41549e10},
 2095 {0, 0x410ed198, 0x421aa180},
 2096 {'q', 0x00000000, 0x41ca6a86},
 2097 {0, 0xc10ed198, 0x421aa181},
 2098 {'8', 0x359a35dd, 0xcb9900bd},
 2099 {'q', 0xc10dbeb5, 0xc155b0f8},
 2100 {0, 0xc10dbeb5, 0xc21aa181},
 2101 {'q', 0x00000000, 0xc1caf3f8},
 2102 {0, 0x410dbeb5, 0xc21aa180},
 2103 {'q', 0x410ed19c, 0xc155b0f8},
 2104 {0, 0x41ce2cab, 0xc155b0f8},
 2105 {'@', 0x00000031, 0x00005773},/*        1        x-advance: 87.449219 */
 2106 {'M', 0x41886037, 0xc1368ce3},
 2107 {'l', 0x41b12e63, 0x00000000},
 2108 {'l', 0x00000000, 0xc298e2cb},
 2109 {'0', 0xcf0013a0, 0x0036ed5f},
 2110 {'l', 0x00000000, 0x42b1957a},
 2111 {'l', 0x41b12e64, 0xb6400000},
 2112 {'l', 0x00000000, 0x41368ce3},
 2113 {'l', 0xc266df5a, 0x00000000},
 2114 {'l', 0xb6000000, 0xc1368ce3},
 2115 {'@', 0x00000032, 0x00005773},/*        2        x-advance: 87.449219 */
 2116 {'M', 0x41d301b8, 0xc1368ce3},
 2117 {'l', 0x423d4302, 0x00000000},
 2118 {'4', 0x002d0000, 0x0000ff02},
 2119 {'l', 0xb6000000, 0xc1368ce3},
 2120 {'8', 0xab54e11e, 0xbb43cb35},
 2121 {'8', 0xcf24e31a, 0xd90aec0a},
 2122 {'8', 0xcceae100, 0xecc6ecea},
 2123 {'8', 0x08cb00e7, 0x1ac408e4},
 2124 {'l', 0x00000000, 0xc15b0f78},
 2125 {'8', 0xed3df320, 0xfa34fa1c},
 2126 {'8', 0x1f63003e, 0x53251f25},
 2127 {'8', 0x2ef71800, 0x34df16f7},
 2128 {'8', 0x2dd607fa, 0x679b25dd},
 2129 {'@', 0x00000033, 0x00005773},/*        3        x-advance: 87.449219 */
 2130 {'M', 0x425f1656, 0xc2581b7d},
 2131 {'8', 0x223c0826, 0x40161a16},
 2132 {'q', 0x00000000, 0x416d50c0},
 2133 {0, 0xc12338b8, 0x41b79fc8},
 2134 {'q', 0xc12338b0, 0x4101eed3},
 2135 {0, 0xc1e7f240, 0x4101eed3},
 2136 {'8', 0xfccc00e7, 0xf1c9fbe6},
 2137 {'l', 0x00000000, 0xc151655e},
 2138 {'8', 0x13310d16, 0x0638061a},
 2139 {'8', 0xec4d0033, 0xc61aec1a},
 2140 {'8', 0xc9e8dd00, 0xecbcece8},
 2141 {'4', 0x0000ffd2, 0xffd40000},
 2142 {'l', 0x41436fae, 0x00000000},
 2143 {'8', 0xf13d0028, 0xd215f015},
 2144 {'8', 0xd1eae200, 0xf0c2f0eb},
 2145 {'8', 0x04d100ea, 0x0fc804e7},
 2146 {'l', 0x00000000, 0xc14149e0},
 2147 {'8', 0xf439f81e, 0xfc33fc1b},
 2148 {'8', 0x1c61003d, 0x4b231b23},
 2149 {'8', 0x38ed2100, 0x1fca16ed},
 2150 {'@', 0x00000034, 0x00005773},/*        4        x-advance: 87.449219 */
 2151 {'M', 0x424fc905, 0xc2b0c74d},
 2152 {'4', 0x00d5ff78, 0x00000088},
 2153 {'6', 0xff2b0000, 0xffd1fff2},
 2154 {'l', 0x41886038, 0x00000000},
 2155 {'l', 0x00000000, 0x42829aa2},
 2156 {'0', 0x2d000039, 0x5e0000c7},
 2157 {'l', 0xc157d6c4, 0x00000000},
 2158 {'l', 0x00000000, 0xc1bcfe48},
 2159 {'l', 0xc234f089, 0x00000000},
 2160 {'l', 0xb5c00000, 0xc151655c},
 2161 {'l', 0x4226b61e, 0xc27df5b1},
 2162 {'@', 0x00000035, 0x00005773},/*        5        x-advance: 87.449219 */
 2163 {'M', 0x416d50c0, 0xc2c86716},
 2164 {'l', 0x4254e2ca, 0x00000000},
 2165 {'4', 0x002d0000, 0x0000ff5d},
 2166 {'l', 0x00000000, 0x41c48294},
 2167 {'8', 0xfb17fc0b, 0xfe17fe0b},
 2168 {'8', 0x246a0043, 0x63272427},
 2169 {'q', 0x00000000, 0x4181655f},
 2170 {0, 0xc12112e8, 0x41c957a0},
 2171 {'q', 0xc12112e4, 0x410ed19d},
 2172 {0, 0xc1e31d34, 0x410ed19d},
 2173 {'8', 0xfccd00e7, 0xf4cbfce6},
 2174 {'l', 0x00000000, 0xc159fc90},
 2175 {'8', 0x13310d18, 0x06360619},
 2176 {'8', 0xe849002e, 0xbe1be81b},
 2177 {'8', 0xbee5d700, 0xe8b7e8e5},
 2178 {'8', 0x04d500eb, 0x0fd404eb},
 2179 {'l', 0x00000000, 0xc249579f},
 2180 {'@', 0x00000036, 0x00005773},/*        6        x-advance: 87.449219 */
 2181 {'M', 0x423579fc, 0xc25e036f},
 2182 {'8', 0x18c700dc, 0x44eb18eb},
 2183 {'8', 0x44152b00, 0x18391815},
 2184 {'8', 0xe8390024, 0xbc15e715},
 2185 {'8', 0xbcebd500, 0xe8c7e8eb},
 2186 {'m', 0x41d74d50, 0xc229eed1},
 2187 {'l', 0x00000000, 0x41459578},
 2188 {'8', 0xf2d7f7ec, 0xfbd7fbec},
 2189 {'8', 0x24ae00cb, 0x6de024e4},
 2190 {'8', 0xdd27e90f, 0xf434f417},
 2191 {'8', 0x245f003c, 0x63232423},
 2192 {'8', 0x63dc3d00, 0x259f25dc},
 2193 {'q', 0xc18b0f76, 0xb4c00000},
 2194 {0, 0xc1d49e10, 0xc1549e11},
 2195 {'q', 0xc1131d36, 0xc155b0f8},
 2196 {0, 0xc1131d36, 0xc21aa181},
 2197 {'q', 0x00000000, 0xc1be112c},
 2198 {0, 0x41346716, 0xc21768ce},
 2199 {'q', 0x41346718, 0xc16293c0},
 2200 {0, 0x41f225cc, 0xc16293c0},
 2201 {'8', 0x04290014, 0x0c2b0414},
 2202 {'@', 0x00000037, 0x00005773},/*        7        x-advance: 87.449219 */
 2203 {'M', 0x41346716, 0xc2c86716},
 2204 {'l', 0x4280dbeb, 0x00000000},
 2205 {'l', 0x00000000, 0x40b8b2b0},
 2206 {'l', 0xc21180dc, 0x42bcdbeb},
 2207 {'l', 0xc16293c2, 0x00000000},
 2208 {'l', 0x4208e9aa, 0xc2b1957a},
 2209 {'l', 0xc2407bb4, 0x00000000},
 2210 {'l', 0xb6000000, 0xc1368ce0},
 2211 {'@', 0x00000038, 0x00005773},/*        8        x-advance: 87.449219 */
 2212 {'M', 0x422ec3dd, 0xc23e55e8},
 2213 {'8', 0x14c400da, 0x38ea14ea},
 2214 {'8', 0x38162400, 0x143c1416},
 2215 {'8', 0xec3c0026, 0xc816ec16},
 2216 {'8', 0xc8eadc00, 0xecc4ecea},
 2217 {'m', 0xc158e9a8, 0xc0b8b2b0},
 2218 {'8', 0xe0caf8de, 0xc6ede9ed},
 2219 {'8', 0xb522d000, 0xe55de522},
 2220 {'8', 0x1b5d003b, 0x4b221b22},
 2221 {'8', 0x3aed2200, 0x20cb17ed},
 2222 {'8', 0x233c0927, 0x40161a16},
 2223 {'8', 0x59dd3a00, 0x1f9b1fdd},
 2224 {'8', 0xe19a00be, 0xa7dde1dd},
 2225 {'8', 0xc016da00, 0xdd3de616},
 2226 {'m', 0xc09eed1c, 0xc1ab4670},
 2227 {'8', 0x30131f00, 0x11361113},
 2228 {'8', 0xef360022, 0xd013ef13},
 2229 {'8', 0xd0ede100, 0xefcaefed},
 2230 {'8', 0x11ca00dd, 0x30ed11ed},
 2231 {'@', 0x00000039, 0x00005773},/*        9        x-advance: 87.449219 */
 2232 {'M', 0x41719c59, 0xc0052784},
 2233 {'l', 0x00000000, 0xc145957a},
 2234 {'8', 0x0e290914, 0x05290514},
 2235 {'8', 0xdd510035, 0x9320dc1c},
 2236 {'8', 0x23d917f1, 0x0ccc0ce9},
 2237 {'8', 0xdca100c4, 0x9ddedcde},
 2238 {'8', 0x9d24c300, 0xdb61db24},
 2239 {'q', 0x418b0f76, 0x00000000},
 2240 {0, 0x41d4149c, 0x4155b0f8},
 2241 {'q', 0x41131d38, 0x41549e10},
 2242 {0, 0x41131d38, 0x421aa180},
 2243 {'q', 0x00000000, 0x41bd87bc},
 2244 {0, 0xc1346718, 0x421768ce},
 2245 {'q', 0xc133542c, 0x416180dd},
 2246 {0, 0xc1f19c58, 0x416180dd},
 2247 {'8', 0xfcd700ec, 0xf4d5fcec},
 2248 {'m', 0x41d7d6c4, 0xc229eed2},
 2249 {'8', 0xe8390024, 0xbc15e815},
 2250 {'8', 0xbcebd500, 0xe7c7e7eb},
 2251 {'8', 0x19c700dc, 0x44eb18eb},
 2252 {'8', 0x44152b00, 0x18391815},
 2253 {'@', 0x0000003a, 0x00002e4f},/*        :        x-advance: 46.308594 */
 2254 {'M', 0x4180dbeb, 0xc1886037},
 2255 {'0', 0x44000038, 0xbc0000c8},
 2256 {'m', 0x00000000, 0xc2581b7c},
 2257 {'0', 0x44000038, 0xbc0000c8},
 2258 {'@', 0x0000003b, 0x00002e4f},/*        ;        x-advance: 46.308594 */
 2259 {'M', 0x4180dbeb, 0xc28e25cc},
 2260 {'0', 0x44000038, 0xbc0000c8},
 2261 {'m', 0x00000000, 0x42581b7c},
 2262 {'0', 0x2e000038, 0x00de55d4},
 2263 {'l', 0x40b01b7c, 0xc1abcfe4},
 2264 {'l', 0x00000000, 0xc138b2b0},
 2265 {'@', 0x0000003c, 0x0000732a},/*        <        x-advance: 115.164062 */
 2266 {'M', 0x42c93543, 0xc2874d51},
 2267 {'l', 0xc28a8604, 0x41c50c08},
 2268 {'l', 0x428a8604, 0x41c3f921},
 2269 {'l', 0x00000000, 0x41436fac},
 2270 {'l', 0xc2ac149e, 0xc1f9aa17},
 2271 {'l', 0xb5800000, 0xc132414c},
 2272 {'l', 0x42ac149e, 0xc1f9aa16},
 2273 {'l', 0x00000000, 0x41436fa8},
 2274 {'@', 0x0000003d, 0x0000732a},/*        =        x-advance: 115.164062 */
 2275 {'M', 0x41690527, 0xc279aa18},
 2276 {'l', 0x42ac149e, 0x00000000},
 2277 {'4', 0x002d0000, 0x0000fea8},
 2278 {'6', 0xffd30000, 0x006d0000},
 2279 {'l', 0x42ac149e, 0x00000000},
 2280 {'l', 0x00000000, 0x41368ce4},
 2281 {'l', 0xc2ac149e, 0x00000000},
 2282 {'l', 0xb5800000, 0xc1368ce4},
 2283 {'@', 0x0000003e, 0x0000732a},/*        >        x-advance: 115.164062 */
 2284 {'M', 0x41690527, 0xc2874d51},
 2285 {'l', 0x00000000, 0xc1436fa8},
 2286 {'l', 0x42ac149e, 0x41f9aa16},
 2287 {'l', 0x00000000, 0x4132414c},
 2288 {'l', 0xc2ac149e, 0x41f9aa17},
 2289 {'l', 0xb5800000, 0xc1436fac},
 2290 {'l', 0x428a414a, 0xc1c3f921},
 2291 {'l', 0xc28a414a, 0xc1c50c08},
 2292 {'@', 0x0000003f, 0x000048f3},/*        ?        x-advance: 72.949219 */
 2293 {'M', 0x41d1eed1, 0xc1886037},
 2294 {'0', 0x44000036, 0xbc0000ca},
 2295 {'m', 0x41538b2a, 0xc11dda32},
 2296 {'4', 0x0000ffcd, 0xffd70000},
 2297 {'8', 0xd407e500, 0xd81fef07},
 2298 {'l', 0x40c149e0, 0xc0bf2418},
 2299 {'8', 0xe616f20f, 0xe706f406},
 2300 {'8', 0xdaefe900, 0xf2d2f2ef},
 2301 {'8', 0x09d300eb, 0x1bcf09e9},
 2302 {'l', 0x00000000, 0xc149e110},
 2303 {'8', 0xea33f119, 0xf935f91a},
 2304 {'8', 0x1a4f0031, 0x441e1a1e},
 2305 {'8', 0x26f71400, 0x29df12f7},
 2306 {'l', 0xc0bcfe48, 0x40b8b2b0},
 2307 {'8', 0x13ef0cf4, 0x0df906fb},
 2308 {'8', 0x0dfe05ff, 0x16000800},
 2309 {'l', 0x00000000, 0x410414a0},
 2310 {'@', 0x00000040, 0x00008973},/*        @        x-advance: 137.449219 */
 2311 {'M', 0x424c9052, 0xc210293c},
 2312 {'8', 0x3c132600, 0x15341513},
 2313 {'8', 0xea330021, 0xc413ea13},
 2314 {'8', 0xc5eddb00, 0xeacceaed},
 2315 {'8', 0x16cd00e0, 0x3bed16ed},
 2316 {'m', 0x42124f08, 0x41a08973},
 2317 {'8', 0x1edb14f0, 0x09d009ec},
 2318 {'8', 0xdfb500d2, 0xa9e4dfe4},
 2319 {'8', 0xa91ccb00, 0xdf4adf1c},
 2320 {'8', 0x0a30001b, 0x1e240914},
 2321 {'4', 0xffdd0000, 0x00000026},
 2322 {'l', 0x00000000, 0x4245957a},
 2323 {'8', 0xdd3dfb27, 0xb316e216},
 2324 {'8', 0xcbf8e400, 0xd2e7e7f8},
 2325 {'8', 0xcbbcdde5, 0xeea9eed8},
 2326 {'8', 0x08c100df, 0x19c808e2},
 2327 {'8', 0x47be1bd6, 0x60e92ce9},
 2328 {'8', 0x4f0f2a00, 0x412c250f},
 2329 {'8', 0x2a411b1c, 0x0e4f0e25},
 2330 {'8', 0xf5430022, 0xdf3df521},
 2331 {'l', 0x40c149e0, 0x40ee63a6},
 2332 {'8', 0x28b71adf, 0x0db00dd9},
 2333 {'8', 0xefa300cf, 0xcdb2efd4},
 2334 {'8', 0xb3ccdfde, 0xa1efd4ef},
 2335 {'8', 0xa312d000, 0xb334d412},
 2336 {'8', 0xcc50de22, 0xee60ee2d},
 2337 {'8', 0x17690038, 0x42511730},
 2338 {'8', 0x391e1a14, 0x3f0a1e0a},
 2339 {'q', 0x00000000, 0x418d3543},
 2340 {0, 0xc12abd00, 0x41ded19d},
 2341 {'q', 0xc12abd00, 0x412338b2},
 2342 {0, 0xc1ebb468, 0x4129aa17},
 2343 {'l', 0x00000000, 0xc1255e7f},
 2344 {'@', 0x00000041, 0x00005e06},/*        A        x-advance: 94.023438 */
 2345 {'M', 0x423beb62, 0xc2adb0f7},
 2346 {'4', 0x00c7ffb7, 0x00000093},
 2347 {'6', 0xff39ffb7, 0xffcbffe2},
 2348 {'l', 0x4175e7f4, 0x00000000},
 2349 {'l', 0x4218c06d, 0x42c86716},
 2350 {'l', 0xc16180d8, 0x00000000},
 2351 {'l', 0xc1120a50, 0xc1cda338},
 2352 {'l', 0xc234abd0, 0x00000000},
 2353 {'l', 0xc1120a4e, 0x41cda338},
 2354 {'l', 0xc164b98e, 0x00000000},
 2355 {'l', 0x42190527, 0xc2c86716},
 2356 {'[', 0x00410041, 0x000003d3},
 2357 {'@', 0x00000042, 0x00005e4b},/*        B        x-advance: 94.292969 */
 2358 {'M', 0x41d86037, 0xc23f68ce},
 2359 {'4', 0x00920000, 0x00000056},
 2360 {'8', 0xef40002b, 0xc915ee15},
 2361 {'8', 0xc9ebdb00, 0xefc0efec},
 2362 {'6', 0x0000ffaa, 0xff5c0000},
 2363 {'4', 0x00780000, 0x00000050},
 2364 {'8', 0xf23b0027, 0xd313f113},
 2365 {'8', 0xd3ede200, 0xf1c5f1ed},
 2366 {'6', 0x0000ffb0, 0xffd4ffca},
 2367 {'l', 0x420a8603, 0x00000000},
 2368 {'8', 0x195f003e, 0x49211921},
 2369 {'8', 0x3aef2400, 0x1bce15ef},
 2370 {'8', 0x233e0827, 0x43161b16},
 2371 {'8', 0x52dc3500, 0x1d991ddc},
 2372 {'l', 0xc20fe482, 0x00000000},
 2373 {'l', 0x00000000, 0xc2c86716},
 2374 {'@', 0x00000043, 0x00005ff9},/*        C        x-advance: 95.972656 */
 2375 {'M', 0x42b10c07, 0xc2b8f769},
 2376 {'l', 0x00000000, 0x4164b990},
 2377 {'8', 0xdac6e7e5, 0xf4bff4e2},
 2378 {'q', 0xc189731c, 0x00000000},
 2379 {0, 0xc1d27843, 0x41289730},
 2380 {'q', 0xc1120a50, 0x41278450},
 2381 {0, 0xc1120a50, 0x41f2af40},
 2382 {'q', 0x00000000, 0x419e63a7},
 2383 {0, 0x41120a50, 0x41f2af40},
 2384 {'8', 0x29692924, 0xf4410022},
 2385 {'9', 0xfff4001f, 0xffda003a},
 2386 {'l', 0x00000000, 0x416293c2},
 2387 {'8', 0x1cc413e4, 0x09bd09e1},
 2388 {'q', 0xc1b60370, 0x34000000},
 2389 {0, 0xc20f5b10, 0xc15e4828},
 2390 {'q', 0xc151655c, 0xc15f5b10},
 2391 {0, 0xc151655c, 0xc21836fb},
 2392 {'q', 0x00000000, 0xc1c149e0},
 2393 {0, 0x4151655e, 0xc21836fa},
 2394 {'q', 0x4151655e, 0xc15f5b10},
 2395 {0, 0x420f5b10, 0xc15f5b10},
 2396 {'8', 0x09430023, 0x1c3b091f},
 2397 {'@', 0x00000044, 0x000069d6},/*        D        x-advance: 105.835938 */
 2398 {'M', 0x41d86037, 0xc2b21eed},
 2399 {'4', 0x01370000, 0x00000041},
 2400 {'q', 0x41a5e7f2, 0x00000000},
 2401 {0, 0x41f2af3e, 0xc11655e8},
 2402 {'q', 0x411aa180, 0xc11655e8},
 2403 {0, 0x411aa180, 0xc1ed50bf},
 2404 {'q', 0x00000000, 0xc1a112e8},
 2405 {0, 0xc11aa180, 0xc1ebb468},
 2406 {'9', 0xffdbffda, 0xffdbff87},
 2407 {'6', 0x0000ffbf, 0xffd4ffca},
 2408 {'l', 0x41ded19c, 0x00000000},
 2409 {'q', 0x41e90526, 0x00000000},
 2410 {0, 0x422b01b7, 0x41425cc8},
 2411 {'q', 0x4159fc90, 0x414149e0},
 2412 {0, 0x4159fc90, 0x421768ce},
 2413 {'q', 0x00000000, 0x41cf3f91},
 2414 {0, 0xc15b0f78, 0x421836fa},
 2415 {'9', 0x0030ffca, 0x0030ff56},
 2416 {'l', 0xc1ded19c, 0x00000000},
 2417 {'l', 0x00000000, 0xc2c86716},
 2418 {'@', 0x00000045, 0x000056d8},/*        E        x-advance: 86.843750 */
 2419 {'M', 0x4157d6c4, 0xc2c86716},
 2420 {'l', 0x427d6c3d, 0x00000000},
 2421 {'l', 0x00000000, 0x41368ce0},
 2422 {'l', 0xc24731d2, 0x00000000},
 2423 {'l', 0xb6000000, 0x41ed50c2},
 2424 {'l', 0x423edf5a, 0x00000000},
 2425 {'l', 0x00000000, 0x41368ce0},
 2426 {'l', 0xc23edf5a, 0x00000000},
 2427 {'l', 0xb6000000, 0x42113c22},
 2428 {'l', 0x424c06de, 0x35800000},
 2429 {'l', 0x00000000, 0x41368ce3},
 2430 {'l', 0xc28120a4, 0x00000000},
 2431 {'l', 0xb6800000, 0xc2c86716},
 2432 {'@', 0x00000046, 0x00004f0f},/*        F        x-advance: 79.058594 */
 2433 {'M', 0x4157d6c4, 0xc2c86716},
 2434 {'l', 0x426655e7, 0x00000000},
 2435 {'l', 0x00000000, 0x41368ce0},
 2436 {'l', 0xc2301b7c, 0x00000000},
 2437 {'l', 0xb6000000, 0x41ec3dda},
 2438 {'l', 0x421eed18, 0x00000000},
 2439 {'l', 0x00000000, 0x41368ce4},
 2440 {'l', 0xc21eed18, 0x00000000},
 2441 {'l', 0xb6000000, 0x423f68ce},
 2442 {'l', 0xc158e9aa, 0x00000000},
 2443 {'l', 0x00000000, 0xc2c86716},
 2444 {'@', 0x00000047, 0x00006a82},/*        G        x-advance: 106.507812 */
 2445 {'M', 0x42a39fc9, 0xc164b98e},
 2446 {'l', 0x00000000, 0xc1d74d51},
 2447 {'l', 0xc1b12e64, 0x00000000},
 2448 {'4', 0xffd40000, 0x0000008e},
 2449 {'l', 0x00000000, 0x422c149e},
 2450 {'8', 0x21bb16e1, 0x0bb00bdb},
 2451 {'q', 0xc1bbeb62, 0x34000000},
 2452 {0, 0xc2131d36, 0xc15b0f76},
 2453 {'q', 0xc1538b28, 0xc15c225c},
 2454 {0, 0xc1538b28, 0xc2190528},
 2455 {'q', 0x00000000, 0xc1c48294},
 2456 {0, 0x41538b2a, 0xc2190526},
 2457 {'q', 0x41549e12, 0xc15c2260},
 2458 {0, 0x42131d36, 0xc15c2260},
 2459 {'8', 0x094a0027, 0x1c410923},
 2460 {'l', 0x00000000, 0x4166df60},
 2461 {'8', 0xdac1e7e2, 0xf4b9f4df},
 2462 {'q', 0xc1931d34, 0x00000000},
 2463 {0, 0xc1dd3542, 0x41244b98},
 2464 {'q', 0xc1131d36, 0x41244b98},
 2465 {0, 0xc1131d36, 0x41f4d50c},
 2466 {'q', 0x00000000, 0x41a225cd},
 2467 {0, 0x41131d36, 0x41f44b99},
 2468 {'8', 0x296e2925, 0xfc33001c},
 2469 {'q', 0x40b46720, 0xbfa338b0},
 2470 {0, 0x412225d0, 0xc07920a4},
 2471 {'@', 0x00000048, 0x0000675b},/*        H        x-advance: 103.355469 */
 2472 {'M', 0x4157d6c4, 0xc2c86716},
 2473 {'l', 0x4158e9aa, 0x00000000},
 2474 {'l', 0x00000000, 0x42244b99},
 2475 {'l', 0x42450c06, 0x00000000},
 2476 {'l', 0x00000000, 0xc2244b99},
 2477 {'l', 0x4158e9a8, 0x00000000},
 2478 {'l', 0x00000000, 0x42c86716},
 2479 {'l', 0xc158e9a8, 0x00000000},
 2480 {'l', 0x00000000, 0xc23edf5b},
 2481 {'l', 0xc2450c06, 0x00000000},
 2482 {'l', 0xb6000000, 0x423edf5b},
 2483 {'l', 0xc158e9aa, 0x00000000},
 2484 {'l', 0x00000000, 0xc2c86716},
 2485 {'@', 0x00000049, 0x00002889},/*        I        x-advance: 40.535156 */
 2486 {'M', 0x4157d6c4, 0xc2c86716},
 2487 {'l', 0x4158e9aa, 0x00000000},
 2488 {'l', 0x00000000, 0x42c86716},
 2489 {'l', 0xc158e9aa, 0x00000000},
 2490 {'l', 0x00000000, 0xc2c86716},
 2491 {'@', 0x0000004a, 0x00002889},/*        J        x-advance: 40.535156 */
 2492 {'M', 0x4157d6c4, 0xc2c86716},
 2493 {'4', 0x00000036, 0x01740000},
 2494 {'8', 0x69e54800, 0x20a820e5},
 2495 {'4', 0x0000ffec, 0xffd30000},
 2496 {'l', 0x40874d50, 0x00000000},
 2497 {'8', 0xec320023, 0xb80eec0e},
 2498 {'l', 0x00000000, 0xc2ba7165},
 2499 {'@', 0x0000004b, 0x00005a22},/*        K        x-advance: 90.132812 */
 2500 {'M', 0x4157d6c4, 0xc2c86716},
 2501 {'l', 0x4158e9aa, 0x00000000},
 2502 {'l', 0x00000000, 0x4229655e},
 2503 {'l', 0x4233dda2, 0xc229655e},
 2504 {'l', 0x418b98ec, 0x00000000},
 2505 {'l', 0xc246ed1a, 0x423ad87b},
 2506 {'l', 0x42552784, 0x4255f5b1},
 2507 {'l', 0xc18ed19c, 0x00000000},
 2508 {'l', 0xc2407bb4, 0xc2410527},
 2509 {'l', 0xb6000000, 0x42410527},
 2510 {'l', 0xc158e9aa, 0x00000000},
 2511 {'l', 0x00000000, 0xc2c86716},
 2512 {'@', 0x0000004c, 0x00004c93},/*        L        x-advance: 76.574219 */
 2513 {'M', 0x4157d6c4, 0xc2c86716},
 2514 {'l', 0x4158e9aa, 0x00000000},
 2515 {'l', 0x00000000, 0x42b1957a},
 2516 {'l', 0x42432af4, 0xb6400000},
 2517 {'l', 0x00000000, 0x41368ce3},
 2518 {'l', 0xc279655f, 0x00000000},
 2519 {'l', 0x00000000, 0xc2c86716},
 2520 {'[', 0x0041004c, 0x00000327},
 2521 {'@', 0x0000004d, 0x00007697},/*        M        x-advance: 118.589844 */
 2522 {'M', 0x4157d6c4, 0xc2c86716},
 2523 {'l', 0x41a19c58, 0x00000000},
 2524 {'l', 0x41cc9054, 0x42886036},
 2525 {'l', 0x41cda336, 0xc2886036},
 2526 {'l', 0x41a19c5c, 0x00000000},
 2527 {'l', 0x00000000, 0x42c86716},
 2528 {'l', 0xc1538b30, 0x00000000},
 2529 {'l', 0x00000000, 0xc2aff920},
 2530 {'l', 0xc1ceb61c, 0x4289731c},
 2531 {'l', 0xc159fc94, 0x36800000},
 2532 {'l', 0xc1ceb61e, 0xc289731c},
 2533 {'l', 0x00000000, 0x42aff920},
 2534 {'l', 0xc1527844, 0x00000000},
 2535 {'l', 0x00000000, 0xc2c86716},
 2536 {'@', 0x0000004e, 0x000066d1},/*        N        x-advance: 102.816406 */
 2537 {'M', 0x4157d6c4, 0xc2c86716},
 2538 {'l', 0x41920a4f, 0x00000000},
 2539 {'l', 0x4231b7d6, 0x42a7a6a8},
 2540 {'l', 0x00000000, 0xc2a7a6a8},
 2541 {'l', 0x41527848, 0x00000000},
 2542 {'l', 0x00000000, 0x42c86716},
 2543 {'l', 0xc1920a50, 0x00000000},
 2544 {'l', 0xc231b7d6, 0xc2a7a6a8},
 2545 {'l', 0x00000000, 0x42a7a6a8},
 2546 {'l', 0xc1527844, 0x00000000},
 2547 {'l', 0x00000000, 0xc2c86716},
 2548 {'@', 0x0000004f, 0x00006c30},/*        O        x-advance: 108.187500 */
 2549 {'M', 0x4258a4f0, 0xc2b6036f},
 2550 {'q', 0xc16c3dd8, 0x00000000},
 2551 {0, 0xc1bbeb61, 0x41301b78},
 2552 {'q', 0xc10a8604, 0x41301b80},
 2553 {0, 0xc10a8604, 0x41f00000},
 2554 {'q', 0x00000000, 0x419768cf},
 2555 {0, 0x410a8604, 0x41ef768d},
 2556 {'8', 0x2c5d2c22, 0xd45d003b},
 2557 {'q', 0x410a8600, 0xc1301b7c},
 2558 {0, 0x410a8600, 0xc1ef768d},
 2559 {'q', 0x00000000, 0xc197f240},
 2560 {0, 0xc10a8600, 0xc1f00000},
 2561 {'9', 0xffd4ffde, 0xffd4ffa3},
 2562 {'m', 0x00000000, 0xc1301b80},
 2563 {'q', 0x41a89730, 0x00000000},
 2564 {0, 0x4206c3de, 0x416293c0},
 2565 {'q', 0x4149e110, 0x416180e0},
 2566 {0, 0x4149e110, 0x421768ce},
 2567 {'q', 0x00000000, 0x41bd87bc},
 2568 {0, 0xc149e110, 0x421768ce},
 2569 {'q', 0xc149e118, 0x416180dd},
 2570 {0, 0xc206c3de, 0x416180dd},
 2571 {'q', 0xc1a920a4, 0xb4c00000},
 2572 {0, 0xc2074d50, 0xc16180dc},
 2573 {'q', 0xc149e114, 0xc16180db},
 2574 {0, 0xc149e114, 0xc21768ce},
 2575 {'q', 0x00000000, 0xc1be112c},
 2576 {0, 0x4149e112, 0xc21768ce},
 2577 {'q', 0x414af3fa, 0xc16293c0},
 2578 {0, 0x42074d50, 0xc16293c0},
 2579 {'[', 0x002d004f, 0x000003d3},
 2580 {'@', 0x00000050, 0x000052e2},/*        P        x-advance: 82.882812 */
 2581 {'M', 0x41d86037, 0xc2b21eed},
 2582 {'4', 0x00960000, 0x00000044},
 2583 {'8', 0xed3a0025, 0xc914ed14},
 2584 {'8', 0xc9ecdd00, 0xedc6edec},
 2585 {'6', 0x0000ffbc, 0xffd4ffca},
 2586 {'l', 0x41f4d50c, 0x00000000},
 2587 {'8', 0x1e650043, 0x59221e22},
 2588 {'8', 0x59de3b00, 0x1e9b1ede},
 2589 {'l', 0xc1886037, 0x00000000},
 2590 {'l', 0x00000000, 0x422112e6},
 2591 {'l', 0xc158e9aa, 0x00000000},
 2592 {'l', 0x00000000, 0xc2c86716},
 2593 {'@', 0x00000051, 0x00006c30},/*        Q        x-advance: 108.187500 */
 2594 {'M', 0x4258a4f0, 0xc2b6036f},
 2595 {'q', 0xc16c3dd8, 0x00000000},
 2596 {0, 0xc1bbeb61, 0x41301b78},
 2597 {'q', 0xc10a8604, 0x41301b80},
 2598 {0, 0xc10a8604, 0x41f00000},
 2599 {'q', 0x00000000, 0x419768cf},
 2600 {0, 0x410a8604, 0x41ef768d},
 2601 {'8', 0x2c5d2c22, 0xd45d003b},
 2602 {'q', 0x410a8600, 0xc1301b7c},
 2603 {0, 0x410a8600, 0xc1ef768d},
 2604 {'q', 0x00000000, 0xc197f240},
 2605 {0, 0xc10a8600, 0xc1f00000},
 2606 {'9', 0xffd4ffde, 0xffd4ffa3},
 2607 {'m', 0x4197f240, 0x42b263a6},
 2608 {'4', 0x004e0047, 0x0000ffbf},
 2609 {'l', 0xc16d50bc, 0xc1805278},
 2610 {'8', 0x00f300f8, 0x00f800fc},
 2611 {'q', 0xc1a920a4, 0x00000000},
 2612 {0, 0xc2074d50, 0xc16180dc},
 2613 {'q', 0xc149e114, 0xc16293c1},
 2614 {0, 0xc149e114, 0xc21768ce},
 2615 {'q', 0x00000000, 0xc1be112c},
 2616 {0, 0x4149e112, 0xc21768ce},
 2617 {'q', 0x414af3fa, 0xc16293c0},
 2618 {0, 0x42074d50, 0xc16293c0},
 2619 {'q', 0x41a89730, 0x00000000},
 2620 {0, 0x4206c3de, 0x416293c0},
 2621 {'q', 0x4149e110, 0x416180e0},
 2622 {0, 0x4149e110, 0x421768ce},
 2623 {'q', 0x00000000, 0x418b98ea},
 2624 {0, 0xc0e180e0, 0x41eeed1a},
 2625 {'q', 0xc0df5b10, 0x4146a860},
 2626 {0, 0xc1a225cc, 0x419293c2},
 2627 {'[', 0x002d0051, 0x000003d3},
 2628 {'@', 0x00000052, 0x00005f80},/*        R        x-advance: 95.500000 */
 2629 {'M', 0x427406df, 0xc23beb62},
 2630 {'8', 0x19210511, 0x35211310},
 2631 {'4', 0x006d0037, 0x0000ffc6},
 2632 {'l', 0xc14d19c8, 0xc1cda338},
 2633 {'8', 0xcbdad8ed, 0xf3cef3ee},
 2634 {'l', 0xc16c3dda, 0x00000000},
 2635 {'l', 0x00000000, 0x4229655e},
 2636 {'4', 0x0000ffca, 0xfe700000},
 2637 {'l', 0x41f4d50c, 0x00000000},
 2638 {'8', 0x1c660044, 0x56211c21},
 2639 {'8', 0x3eef2500, 0x22cd18ef},
 2640 {'m', 0xc207d6c4, 0xc2285278},
 2641 {'4', 0x008e0000, 0x00000044},
 2642 {'8', 0xef3b0027, 0xcb14ee14},
 2643 {'8', 0xccecdd00, 0xefc5efed},
 2644 {'l', 0xc1886037, 0x00000000},
 2645 {'@', 0x00000053, 0x0000573f},/*        S        x-advance: 87.246094 */
 2646 {'M', 0x42931d35, 0xc2c1d354},
 2647 {'l', 0x00000000, 0x41538b28},
 2648 {'8', 0xeac6f2e2, 0xf9ccf9e5},
 2649 {'8', 0x11bc00d4, 0x30e911e9},
 2650 {'8', 0x280f1a00, 0x153c0d10},
 2651 {'l', 0x410301b8, 0x3fd6c3e0},
 2652 {'8', 0x28590b3c, 0x4d1c1c1c},
 2653 {'q', 0x00000000, 0x41690528},
 2654 {0, 0xc11cc750, 0x41b0a4f0},
 2655 {'q', 0xc11bb464, 0x40f08975},
 2656 {0, 0xc1e4b98c, 0x40f08975},
 2657 {'8', 0xfac400e4, 0xedbefae1},
 2658 {'l', 0x00000000, 0xc15f5b0f},
 2659 {'8', 0x1b401221, 0x093e091f},
 2660 {'8', 0xee47002e, 0xcc19ee19},
 2661 {'8', 0xd2eee300, 0xe8c5f0ef},
 2662 {'l', 0xc10414a0, 0xbfce2cc0},
 2663 {'8', 0xdba9f4c4, 0xb9e5e7e5},
 2664 {'8', 0xad25cb00, 0xe267e225},
 2665 {'8', 0x0539001c, 0x0f3b051d},
 2666 {'[', 0x00410053, 0x0000028c},
 2667 {'@', 0x00000054, 0x000053f5},/*        T        x-advance: 83.957031 */
 2668 {'M', 0xbece2cac, 0xc2c86716},
 2669 {'l', 0x42a987bb, 0x00000000},
 2670 {'l', 0x00000000, 0x41368ce0},
 2671 {'l', 0xc20e4828, 0x00000000},
 2672 {'l', 0x00000000, 0x42b1957a},
 2673 {'l', 0xc159fc90, 0x00000000},
 2674 {'l', 0x00000000, 0xc2b1957a},
 2675 {'l', 0xc20e4829, 0x00000000},
 2676 {'l', 0xb5b00000, 0xc1368ce0},
 2677 {'@', 0x00000055, 0x0000649a},/*        U        x-advance: 100.601562 */
 2678 {'M', 0x413f2414, 0xc2c86716},
 2679 {'4', 0x00000036, 0x00f30000},
 2680 {'8', 0x5c174000, 0x1c4b1c17},
 2681 {'8', 0xe44b0034, 0xa417e417},
 2682 {'4', 0xff0d0000, 0x00000036},
 2683 {'l', 0x00000000, 0x427a338b},
 2684 {'q', 0x00000000, 0x419cc74d},
 2685 {0, 0xc11bb468, 0x41ecc74c},
 2686 {'q', 0xc11aa180, 0x41200001},
 2687 {0, 0xc1e4b98e, 0x41200001},
 2688 {'q', 0xc197f240, 0xb4c00000},
 2689 {0, 0xc1e5cc74, 0xc1200000},
 2690 {'q', 0xc11aa180, 0xc11fffff},
 2691 {0, 0xc11aa180, 0xc1ecc74c},
 2692 {'l', 0x00000000, 0xc27a338b},
 2693 {'@', 0x00000056, 0x00005e06},/*        V        x-advance: 94.023438 */
 2694 {'M', 0x421d50c0, 0x00000000},
 2695 {'l', 0xc2190527, 0xc2c86716},
 2696 {'l', 0x416293c1, 0x00000000},
 2697 {'l', 0x41fdf5b2, 0x42a8b98e},
 2698 {'l', 0x41fe7f24, 0xc2a8b98e},
 2699 {'l', 0x416180d8, 0x00000000},
 2700 {'l', 0xc218c06d, 0x42c86716},
 2701 {'l', 0xc175e7f4, 0x00000000},
 2702 {'@', 0x00000057, 0x000087e7},/*        W        x-advance: 135.902344 */
 2703 {'M', 0x40920a4f, 0xc2c86716},
 2704 {'l', 0x415b0f76, 0x00000000},
 2705 {'l', 0x41a89731, 0x42a9655e},
 2706 {'l', 0x41a80dbe, 0xc2a9655e},
 2707 {'l', 0x4173c224, 0x00000000},
 2708 {'l', 0x41a89734, 0x42a9655e},
 2709 {'l', 0x41a80dbc, 0xc2a9655e},
 2710 {'l', 0x415c2260, 0x00000000},
 2711 {'l', 0xc1c957a0, 0x42c86716},
 2712 {'l', 0xc1886038, 0x00000000},
 2713 {'l', 0xc1a920a4, 0xc2adf5b1},
 2714 {'l', 0xc1aabcfe, 0x42adf5b1},
 2715 {'l', 0xc1886036, 0x00000000},
 2716 {'l', 0xc1c8ce2c, 0xc2c86716},
 2717 {'@', 0x00000058, 0x00005e29},/*        X        x-advance: 94.160156 */
 2718 {'M', 0x410a8603, 0xc2c86716},
 2719 {'l', 0x41690527, 0x00000000},
 2720 {'l', 0x41c731d3, 0x4214fe48},
 2721 {'l', 0x41c844b8, 0xc214fe48},
 2722 {'l', 0x41690528, 0x00000000},
 2723 {'l', 0xc200dbeb, 0x42407bb4},
 2724 {'l', 0x4209731d, 0x42505278},
 2725 {'l', 0xc1690528, 0x00000000},
 2726 {'l', 0xc1e180da, 0xc22a7844},
 2727 {'l', 0xc1e31d35, 0x422a7844},
 2728 {'l', 0xc16a180e, 0x00000000},
 2729 {'l', 0x420f1656, 0xc255f5b1},
 2730 {'l', 0xc1f9aa18, 0xc23ad87b},
 2731 {'@', 0x00000059, 0x000053f5},/*        Y        x-advance: 83.957031 */
 2732 {'M', 0xbe89731d, 0xc2c86716},
 2733 {'l', 0x41690527, 0x00000000},
 2734 {'l', 0x41de4829, 0x4224d50c},
 2735 {'l', 0x41dcabd0, 0xc224d50c},
 2736 {'l', 0x41690528, 0x00000000},
 2737 {'l', 0xc20dbeb6, 0x4251eed1},
 2738 {'l', 0x00000000, 0x423edf5b},
 2739 {'l', 0xc159fc90, 0x00000000},
 2740 {'l', 0x00000000, 0xc23edf5b},
 2741 {'l', 0xc20dbeb6, 0xc251eed1},
 2742 {'@', 0x0000005a, 0x00005e29},/*        Z        x-advance: 94.160156 */
 2743 {'M', 0x40f6fad8, 0xc2c86716},
 2744 {'l', 0x429d731c, 0x00000000},
 2745 {'l', 0x00000000, 0x41255e80},
 2746 {'l', 0xc27d6c3c, 0x429ce9aa},
 2747 {'l', 0x4281cc74, 0xb6400000},
 2748 {'l', 0x00000000, 0x41368ce3},
 2749 {'l', 0xc2a39fc8, 0x00000000},
 2750 {'l', 0xb6400000, 0xc1255e7f},
 2751 {'l', 0x427d6c3d, 0xc29ce9aa},
 2752 {'l', 0xc2773f91, 0x00000000},
 2753 {'l', 0x00000000, 0xc1368ce0},
 2754 {'@', 0x0000005b, 0x0000359f},/*        [        x-advance: 53.621094 */
 2755 {'M', 0x413cfe48, 0xc2d0dbeb},
 2756 {'l', 0x41e3a6a8, 0x00000000},
 2757 {'l', 0x00000000, 0x41198e98},
 2758 {'l', 0xc180dbeb, 0x00000000},
 2759 {'l', 0x00000000, 0x42ceb61f},
 2760 {'l', 0x4180dbeb, 0xb5800000},
 2761 {'l', 0x00000000, 0x41198e9b},
 2762 {'l', 0xc1e3a6a8, 0x00000000},
 2763 {'l', 0x00000000, 0xc2f519c5},
 2764 {'@', 0x0000005c, 0x00002e4f},/*       \         x-advance: 46.308594 */
 2765 {'M', 0x41368ce3, 0xc2c86716},
 2766 {'l', 0x420b98e9, 0x42e1e7f2},
 2767 {'l', 0xc1368ce4, 0xb5800000},
 2768 {'l', 0xc20b98e9, 0xc2e1e7f2},
 2769 {'l', 0x41368ce3, 0x00000000},
 2770 {'@', 0x0000005d, 0x0000359f},/*        ]        x-advance: 53.621094 */
 2771 {'M', 0x42273f92, 0xc2d0dbeb},
 2772 {'l', 0x00000000, 0x42f519c5},
 2773 {'l', 0xc1e3a6a8, 0x36000000},
 2774 {'l', 0xb5800000, 0xc1198e9b},
 2775 {'l', 0x41805278, 0x00000000},
 2776 {'l', 0x00000000, 0xc2ceb61f},
 2777 {'l', 0xc1805278, 0x00000000},
 2778 {'l', 0xb5800000, 0xc1198e98},
 2779 {'l', 0x41e3a6a8, 0x00000000},
 2780 {'@', 0x0000005e, 0x0000732a},/*        ^        x-advance: 115.164062 */
 2781 {'M', 0x42805278, 0xc2c86716},
 2782 {'l', 0x4211c596, 0x421587bb},
 2783 {'l', 0xc157d6c8, 0x00000000},
 2784 {'l', 0xc1ec3dd8, 0xc1d4149e},
 2785 {'l', 0xc1ec3ddb, 0x41d4149e},
 2786 {'l', 0xc157d6c3, 0x00000000},
 2787 {'l', 0x4211c595, 0xc21587bb},
 2788 {'l', 0x41527844, 0x00000000},
 2789 {'@', 0x0000005f, 0x000044b9},/*        _        x-advance: 68.722656 */
 2790 {'M', 0x428c225d, 0x41b68ce3},
 2791 {'l', 0x00000000, 0x41198e9a},
 2792 {'l', 0xc28ed19d, 0x00000000},
 2793 {'l', 0x36600000, 0xc1198e9a},
 2794 {'l', 0x428ed19d, 0x00000000},
 2795 {'@', 0x00000060, 0x000044b9},/*        `        x-advance: 68.722656 */
 2796 {'M', 0x41c50c07, 0xc2dbdda3},
 2797 {'0', 0x00d7644b, 0x00349ca9},
 2798 {'@', 0x00000061, 0x0000543a},/*        a        x-advance: 84.226562 */
 2799 {'M', 0x423c74d5, 0xc2172414},
 2800 {'8', 0x0dae00c5, 0x2ee90de9},
 2801 {'8', 0x29111a00, 0x0f2f0f11},
 2802 {'8', 0xe4410029, 0xb318e318},
 2803 {'4', 0xfff50000, 0x0000ffcf},
 2804 {'m', 0x41c50c06, 0xc0a338b8},
 2805 {'4', 0x00ab0000, 0x0000ffcf},
 2806 {'l', 0x00000000, 0xc1368ce3},
 2807 {'8', 0x28d61bf0, 0x0cc30ce7},
 2808 {'8', 0xe7b700d2, 0xbbe5e6e5},
 2809 {'8', 0xb421ce00, 0xe765e722},
 2810 {'4', 0x00000045, 0xfffc0000},
 2811 {'8', 0xcceade00, 0xeec2eeea},
 2812 {'8', 0x06ce00e7, 0x12d206e8},
 2813 {'l', 0x00000000, 0xc1368ce4},
 2814 {'8', 0xf134f61b, 0xfb31fb19},
 2815 {'8', 0x21610041, 0x66202120},
 2816 {'@', 0x00000062, 0x0000573f},/*        b        x-advance: 87.246094 */
 2817 {'M', 0x4285d354, 0xc216112e},
 2818 {'8', 0xabeaca00, 0xe1c3e1ea},
 2819 {'8', 0x1fc300d9, 0x55ea1eea},
 2820 {'8', 0x55163600, 0x1e3d1e16},
 2821 {'8', 0xe23d0027, 0xab16e116},
 2822 {'m', 0xc2280dbe, 0xc1d1eed2},
 2823 {'8', 0xd927e60f, 0xf338f317},
 2824 {'q', 0x415b0f74, 0x00000000},
 2825 {0, 0x41b1b7d6, 0x412df5b0},
 2826 {'q', 0x41097320, 0x412df5b4},
 2827 {0, 0x41097320, 0x41e4b990},
 2828 {'q', 0x00000000, 0x418dbeb6},
 2829 {0, 0xc1097320, 0x41e4b98e},
 2830 {'8', 0x2ba82bde, 0xf4c800df},
 2831 {'9', 0xfff3ffe9, 0xffd8ffd9},
 2832 {'l', 0x00000000, 0x41346716},
 2833 {'l', 0xc146a860, 0x00000000},
 2834 {'l', 0x00000000, 0xc2d0dbeb},
 2835 {'l', 0x4146a860, 0x00000000},
 2836 {'l', 0x00000000, 0x4222af3f},
 2837 {'@', 0x00000063, 0x00004b92},/*        c        x-advance: 75.570312 */
 2838 {'M', 0x4286180e, 0xc2909052},
 2839 {'l', 0x00000000, 0x4138b2ac},
 2840 {'8', 0xefd6f5ec, 0xfbd6fbec},
 2841 {'8', 0x1eb600d0, 0x55e61ee6},
 2842 {'8', 0x551a3700, 0x1e4a1e1a},
 2843 {'8', 0xfb2a0015, 0xef2afb15},
 2844 {'l', 0x00000000, 0x41368ce2},
 2845 {'8', 0x0ed609ec, 0x04d204ea},
 2846 {'q', 0xc187d6c4, 0x00000000},
 2847 {0, 0xc1d7d6c4, 0xc12abcfe},
 2848 {'q', 0xc1200000, 0xc12abcff},
 2849 {0, 0xc1200000, 0xc1e655e8},
 2850 {'q', 0xb5000000, 0xc1931d36},
 2851 {0, 0x412112e6, 0xc1e768d0},
 2852 {'8', 0xd66ed628, 0x042c0016},
 2853 {'q', 0x40adf5b0, 0x3f920a80},
 2854 {0, 0x41289734, 0x405f5b20},
 2855 {'@', 0x00000064, 0x0000573f},/*        d        x-advance: 87.246094 */
 2856 {'M', 0x4279aa18, 0xc27f0897},
 2857 {'l', 0x00000000, 0xc222af3f},
 2858 {'l', 0x41459578, 0x00000000},
 2859 {'4', 0x01a10000, 0x0000ffcf},
 2860 {'l', 0x00000000, 0xc1346716},
 2861 {'8', 0x28d91af1, 0x0cc80ce9},
 2862 {'q', 0xc159fc90, 0x34000000},
 2863 {0, 0xc1b1b7d7, 0xc12df5b0},
 2864 {'q', 0xc1086036, 0xc12df5b0},
 2865 {0, 0xc1086036, 0xc1e4b98e},
 2866 {'q', 0xb5000000, 0xc18dbeb6},
 2867 {0, 0x41086036, 0xc1e4b990},
 2868 {'8', 0xd558d522, 0x0d380021},
 2869 {'9', 0x000c0017, 0x00270027},
 2870 {'m', 0xc2285278, 0x41d1eed2},
 2871 {'8', 0x55163600, 0x1e3d1e16},
 2872 {'8', 0xe23d0027, 0xab16e116},
 2873 {'8', 0xabeaca00, 0xe1c3e1ea},
 2874 {'8', 0x1fc300d9, 0x55ea1eea},
 2875 {'@', 0x00000065, 0x00005490},/*        e        x-advance: 84.562500 */
 2876 {'M', 0x429a7f24, 0xc222af3f},
 2877 {'4', 0x00180000, 0x0000ff1d},
 2878 {'8', 0x4d1e3303, 0x1a4c1a1b},
 2879 {'8', 0xfa37001c, 0xec35fa1a},
 2880 {'l', 0x00000000, 0x413ad87b},
 2881 {'8', 0x11ca0be6, 0x05c805e5},
 2882 {'q', 0xc18fe482, 0x00000000},
 2883 {0, 0xc1e4301b, 0xc127844c},
 2884 {'q', 0xc127844a, 0xc127844b},
 2885 {0, 0xc127844a, 0xc1e293c2},
 2886 {'q', 0xb5000000, 0xc193a6a8},
 2887 {0, 0x411eed1a, 0xc1ea180e},
 2888 {'8', 0xd56bd527, 0x275f003c},
 2889 {'9', 0x00260023, 0x006a0023},
 2890 {'m', 0xc1459578, 0xc067f240},
 2891 {'8', 0xc0ead800, 0xe8c6e8ea},
 2892 {'8', 0x17be00d7, 0x41e417e8},
 2893 {'l', 0x42301b7e, 0xbd897200},
 2894 {'@', 0x00000066, 0x00003063},/*        f        x-advance: 48.386719 */
 2895 {'M', 0x424c06df, 0xc2d0dbeb},
 2896 {'4', 0x00290000, 0x0000ffd1},
 2897 {'8', 0x0adb00e6, 0x26f60af6},
 2898 {'0', 0x00511a00, 0x00af2600},
 2899 {'l', 0x00000000, 0x42832414},
 2900 {'l', 0xc146a85f, 0x00000000},
 2901 {'l', 0x00000000, 0xc2832414},
 2902 {'0', 0xda0000d1, 0xec00002f},
 2903 {'8', 0xb717ce00, 0xe94ae917},
 2904 {'l', 0x413ad87c, 0x00000000},
 2905 {'@', 0x00000067, 0x0000573f},/*        g        x-advance: 87.246094 */
 2906 {'M', 0x4279aa18, 0xc219d354},
 2907 {'8', 0xadeacb00, 0xe3c2e3ea},
 2908 {'8', 0x1dc200d9, 0x53ea1dea},
 2909 {'8', 0x52163500, 0x1d3e1d16},
 2910 {'8', 0xe33e0028, 0xae16e316},
 2911 {'m', 0x41459578, 0x41e90528},
 2912 {'q', 0x00000000, 0x41998e9a},
 2913 {0, 0xc1086038, 0x41e4b98e},
 2914 {'8', 0x259825de, 0xfdcf00e6},
 2915 {'9', 0xfffcffe9, 0xfff4ffd4},
 2916 {'l', 0x00000000, 0xc14036fb},
 2917 {'8', 0x112a0b15, 0x052b0515},
 2918 {'8', 0xe7480030, 0xb418e718},
 2919 {'l', 0x00000000, 0xc0c36fb0},
 2920 {'8', 0x27d91af1, 0x0dc70de9},
 2921 {'8', 0xd6a700c9, 0x91dfd6df},
 2922 {'8', 0x9121bb00, 0xd659d621},
 2923 {'8', 0x0d390021, 0x27270d17},
 2924 {'l', 0x00000000, 0xc1368ce4},
 2925 {'l', 0x41459578, 0x00000000},
 2926 {'l', 0x00000000, 0x4283ad88},
 2927 {'@', 0x00000068, 0x0000571d},/*        h        x-advance: 87.113281 */
 2928 {'M', 0x4296df5b, 0xc23579fc},
 2929 {'4', 0x00b50000, 0x0000ffcf},
 2930 {'l', 0x00000000, 0xc233dda3},
 2931 {'8', 0xc1f0d600, 0xebcfebf0},
 2932 {'8', 0x19c100d8, 0x45e919e9},
 2933 {'l', 0x00000000, 0x4229eed1},
 2934 {'l', 0xc146a860, 0x00000000},
 2935 {'4', 0xfe5f0000, 0x00000031},
 2936 {'l', 0x00000000, 0x4223c225},
 2937 {'8', 0xd829e511, 0xf337f318},
 2938 {'8', 0x204e0033, 0x5e1a1f1a},
 2939 {'@', 0x00000069, 0x00002630},/*        i        x-advance: 38.187500 */
 2940 {'M', 0x414f3f92, 0xc29655e8},
 2941 {'l', 0x4145957a, 0x00000000},
 2942 {'4', 0x012c0000, 0x0000ffcf},
 2943 {'6', 0xfed40000, 0xff8b0000},
 2944 {'0', 0x3e000031, 0xc20000cf},
 2945 {'@', 0x0000006a, 0x00002630},/*        j        x-advance: 38.187500 */
 2946 {'M', 0x414f3f92, 0xc29655e8},
 2947 {'4', 0x00000031, 0x01320000},
 2948 {'8', 0x53ea3900, 0x19ba19eb},
 2949 {'4', 0x0000ffee, 0xffd70000},
 2950 {'l', 0x40527845, 0x00000000},
 2951 {'8', 0xf426001c, 0xca0af30a},
 2952 {'6', 0xfece0000, 0xff8b0000},
 2953 {'0', 0x3e000031, 0xc20000cf},
 2954 {'@', 0x0000006b, 0x00004f98},/*        k        x-advance: 79.593750 */
 2955 {'M', 0x4147bb46, 0xc2d0dbeb},
 2956 {'l', 0x4146a860, 0x00000000},
 2957 {'l', 0x00000000, 0x4276b61e},
 2958 {'l', 0x421361ee, 0xc201aa18},
 2959 {'l', 0x417c5958, 0x00000000},
 2960 {'l', 0xc21f768d, 0x420cabd0},
 2961 {'l', 0x42262cab, 0x42200000},
 2962 {'l', 0xc180dbea, 0x00000000},
 2963 {'l', 0xc218c06e, 0xc212d87b},
 2964 {'l', 0x36000000, 0x4212d87b},
 2965 {'l', 0xc146a860, 0x00000000},
 2966 {'l', 0x00000000, 0xc2d0dbeb},
 2967 {'@', 0x0000006c, 0x00002630},/*        l        x-advance: 38.187500 */
 2968 {'M', 0x414f3f92, 0xc2d0dbeb},
 2969 {'l', 0x4145957a, 0x00000000},
 2970 {'l', 0x00000000, 0x42d0dbeb},
 2971 {'l', 0xc145957a, 0x00000000},
 2972 {'l', 0x00000000, 0xc2d0dbeb},
 2973 {'@', 0x0000006d, 0x000085e4},/*        m        x-advance: 133.890625 */
 2974 {'M', 0x428ef3f9, 0xc272f3f9},
 2975 {'8', 0xcf2cdf12, 0xf13cf119},
 2976 {'8', 0x2148002e, 0x5d192019},
 2977 {'4', 0x00b50000, 0x0000ffcf},
 2978 {'l', 0x00000000, 0xc233dda3},
 2979 {'8', 0xc0f1d500, 0xecd2ecf1},
 2980 {'8', 0x19c400da, 0x45ea19ea},
 2981 {'4', 0x00a90000, 0x0000ffcf},
 2982 {'l', 0x00000000, 0xc233dda3},
 2983 {'8', 0xc0f1d500, 0xecd1ecf1},
 2984 {'8', 0x19c400db, 0x45ea19ea},
 2985 {'l', 0x00000000, 0x4229eed1},
 2986 {'l', 0xc146a860, 0x00000000},
 2987 {'4', 0xfed40000, 0x00000031},
 2988 {'l', 0x00000000, 0x413ad87c},
 2989 {'8', 0xd828e510, 0xf338f317},
 2990 {'8', 0x10370020, 0x30221017},
 2991 {'@', 0x0000006e, 0x0000571d},/*        n        x-advance: 87.113281 */
 2992 {'M', 0x4296df5b, 0xc23579fc},
 2993 {'4', 0x00b50000, 0x0000ffcf},
 2994 {'l', 0x00000000, 0xc233dda3},
 2995 {'8', 0xc1f0d600, 0xebcfebf0},
 2996 {'8', 0x19c100d8, 0x45e919e9},
 2997 {'l', 0x00000000, 0x4229eed1},
 2998 {'l', 0xc146a860, 0x00000000},
 2999 {'4', 0xfed40000, 0x00000031},
 3000 {'l', 0x00000000, 0x413ad87c},
 3001 {'8', 0xd829e511, 0xf337f318},
 3002 {'8', 0x204e0033, 0x5e1a1f1a},
 3003 {'@', 0x0000006f, 0x00005418},/*        o        x-advance: 84.093750 */
 3004 {'M', 0x42285278, 0xc2850527},
 3005 {'8', 0x1fc200d9, 0x54e91ee9},
 3006 {'8', 0x55163500, 0x1e3f1e17},
 3007 {'8', 0xe13e0027, 0xac17e117},
 3008 {'8', 0xace9cb00, 0xe1c2e1e9},
 3009 {'m', 0x00000000, 0xc1278450},
 3010 {'q', 0x4180dbec, 0x00000000},
 3011 {0, 0x41ca6a84, 0x41278450},
 3012 {'q', 0x41131d38, 0x41278448},
 3013 {0, 0x41131d38, 0x41e7f240},
 3014 {'q', 0x00000000, 0x4193a6a8},
 3015 {0, 0xc1131d38, 0x41e7f240},
 3016 {'8', 0x299b29dc, 0xd79b00c0},
 3017 {'q', 0xc1120a4e, 0xc1289731},
 3018 {0, 0xc1120a4e, 0xc1e7f240},
 3019 {'q', 0xb5000000, 0xc194301c},
 3020 {0, 0x41120a4e, 0xc1e7f240},
 3021 {'q', 0x41131d36, 0xc1278450},
 3022 {0, 0x41caf3f9, 0xc1278450},
 3023 {'[', 0x002d006f, 0x0000028c},
 3024 {'@', 0x00000070, 0x0000573f},/*        p        x-advance: 87.246094 */
 3025 {'M', 0x41c731d3, 0xc1346716},
 3026 {'l', 0x00000000, 0x421f768c},
 3027 {'l', 0xc146a860, 0x36000000},
 3028 {'4', 0xfe610000, 0x00000031},
 3029 {'l', 0x00000000, 0x41368ce4},
 3030 {'8', 0xd927e60f, 0xf338f317},
 3031 {'q', 0x415b0f74, 0x00000000},
 3032 {0, 0x41b1b7d6, 0x412df5b0},
 3033 {'q', 0x41097320, 0x412df5b4},
 3034 {0, 0x41097320, 0x41e4b990},
 3035 {'q', 0x00000000, 0x418dbeb6},
 3036 {0, 0xc1097320, 0x41e4b98e},
 3037 {'8', 0x2ba82bde, 0xf4c800df},
 3038 {'9', 0xfff3ffe9, 0xffd8ffd9},
 3039 {'m', 0x42280dbe, 0xc1d1eed1},
 3040 {'8', 0xabeaca00, 0xe1c3e1ea},
 3041 {'8', 0x1fc300d9, 0x55ea1eea},
 3042 {'8', 0x55163600, 0x1e3d1e16},
 3043 {'8', 0xe23d0027, 0xab16e116},
 3044 {'@', 0x00000071, 0x0000573f},/*        q        x-advance: 87.246094 */
 3045 {'M', 0x41a2af3f, 0xc216112e},
 3046 {'8', 0x55163600, 0x1e3d1e16},
 3047 {'8', 0xe23d0027, 0xab16e116},
 3048 {'8', 0xabeaca00, 0xe1c3e1ea},
 3049 {'8', 0x1fc300d9, 0x55ea1eea},
 3050 {'m', 0x42285278, 0x41d1eed1},
 3051 {'8', 0x28d91af1, 0x0cc80ce9},
 3052 {'q', 0xc159fc90, 0x34000000},
 3053 {0, 0xc1b1b7d7, 0xc12df5b0},
 3054 {'q', 0xc1086036, 0xc12df5b0},
 3055 {0, 0xc1086036, 0xc1e4b98e},
 3056 {'q', 0xb5000000, 0xc18dbeb6},
 3057 {0, 0x41086036, 0xc1e4b990},
 3058 {'8', 0xd558d522, 0x0d380021},
 3059 {'9', 0x000c0017, 0x00270027},
 3060 {'l', 0x00000000, 0xc1368ce4},
 3061 {'l', 0x41459578, 0x00000000},
 3062 {'l', 0x00000000, 0x42cf844c},
 3063 {'l', 0xc1459578, 0xb6800000},
 3064 {'l', 0x00000000, 0xc21f768c},
 3065 {'@', 0x00000072, 0x00003882},/*        r        x-advance: 56.507812 */
 3066 {'M', 0x42620a4f, 0xc27e7f24},
 3067 {'8', 0xfaeefcf8, 0xfeebfef7},
 3068 {'8', 0x1bc000d7, 0x4eea1bea},
 3069 {'l', 0x00000000, 0x421e63a6},
 3070 {'l', 0xc146a860, 0x00000000},
 3071 {'4', 0xfed40000, 0x00000031},
 3072 {'l', 0x00000000, 0x413ad87c},
 3073 {'8', 0xd828e50f, 0xf33cf318},
 3074 {'8', 0x000b0005, 0x010d0006},
 3075 {'l', 0x3d897400, 0x414af3f8},
 3076 {'@', 0x00000073, 0x0000479c},/*        s        x-advance: 71.609375 */
 3077 {'M', 0x42737d6c, 0xc291e7f2},
 3078 {'l', 0x00000000, 0x413ad87c},
 3079 {'8', 0xf0d5f6ec, 0xfbd2fbea},
 3080 {'8', 0x0bc900dc, 0x21ee0bee},
 3081 {'8', 0x1b0d1100, 0x1234090d},
 3082 {'l', 0x40874d50, 0x3f708980},
 3083 {'8', 0x1f4a0b34, 0x39161416},
 3084 {'8', 0x42df2900, 0x18a518df},
 3085 {'8', 0xfcce00e8, 0xf2c9fce6},
 3086 {'l', 0x00000000, 0xc14c06df},
 3087 {'8', 0x15350e1b, 0x0634061a},
 3088 {'8', 0xf5350022, 0xdf12f412},
 3089 {'8', 0xe2f3ec00, 0xecc5f6f3},
 3090 {'l', 0xc0897320, 0xbf80dbe0},
 3091 {'8', 0xe3bef7d3, 0xc9ececec},
 3092 {'8', 0xbf1ed600, 0xe955e91e},
 3093 {'8', 0x0433001b, 0x0c2c0418},
 3094 {'@', 0x00000074, 0x000035e4},/*        t        x-advance: 53.890625 */
 3095 {'M', 0x41c9579f, 0xc2c10527},
 3096 {'0', 0x00655500, 0x009b2600},
 3097 {'l', 0x00000000, 0x422338b2},
 3098 {'8', 0x2f092400, 0x0a290a0a},
 3099 {'4', 0x00000032, 0x00290000},
 3100 {'l', 0xc14af3f8, 0x00000000},
 3101 {'8', 0xebb200c7, 0xb3ebebeb},
 3102 {'l', 0x00000000, 0xc22338b2},
 3103 {'0', 0xda0000dc, 0xab000024},
 3104 {'l', 0x4146a85f, 0x00000000},
 3105 {'@', 0x00000075, 0x0000571d},/*        u        x-advance: 87.113281 */
 3106 {'M', 0x413ad87b, 0xc1ed50c0},
 3107 {'4', 0xff4a0000, 0x00000031},
 3108 {'l', 0x00000000, 0x4234225d},
 3109 {'8', 0x40102a00, 0x15311510},
 3110 {'8', 0xe73f0028, 0xbb17e717},
 3111 {'l', 0x00000000, 0xc22a7845},
 3112 {'l', 0x41459574, 0x00000000},
 3113 {'4', 0x012c0000, 0x0000ffcf},
 3114 {'l', 0x00000000, 0xc138b2af},
 3115 {'8', 0x28d71bef, 0x0dc90de9},
 3116 {'8', 0xe0b200cd, 0xa2e6e0e6},
 3117 {'m', 0x41f89732, 0xc23d4302},
 3118 {'l', 0x00000000, 0x00000000},
 3119 {'@', 0x00000076, 0x00005157},/*        v        x-advance: 81.339844 */
 3120 {'M', 0x408301b8, 0xc29655e8},
 3121 {'l', 0x4151655e, 0x00000000},
 3122 {'l', 0x41bbeb61, 0x427c5958},
 3123 {'l', 0x41bbeb62, 0xc27c5958},
 3124 {'l', 0x41516560, 0x00000000},
 3125 {'l', 0xc1e180dc, 0x429655e8},
 3126 {'l', 0xc1863a6a, 0x00000000},
 3127 {'l', 0xc1e180dc, 0xc29655e8},
 3128 {'@', 0x00000077, 0x0000706a},/*        w        x-advance: 112.414062 */
 3129 {'M', 0x40b8b2af, 0xc29655e8},
 3130 {'l', 0x4145957a, 0x00000000},
 3131 {'l', 0x4176fad6, 0x426aa181},
 3132 {'l', 0x4175e7f4, 0xc26aa181},
 3133 {'l', 0x41690528, 0x00000000},
 3134 {'l', 0x4176fad4, 0x426aa181},
 3135 {'l', 0x4175e7f8, 0xc26aa181},
 3136 {'l', 0x41459578, 0x00000000},
 3137 {'l', 0xc19d50c0, 0x429655e8},
 3138 {'l', 0xc1690528, 0x00000000},
 3139 {'l', 0xc1816560, 0xc2767165},
 3140 {'l', 0xc181eed0, 0x42767165},
 3141 {'l', 0xc1690528, 0x00000000},
 3142 {'l', 0xc19d50c0, 0xc29655e8},
 3143 {'@', 0x00000078, 0x00005157},/*        x        x-advance: 81.339844 */
 3144 {'M', 0x4296df5b, 0xc29655e8},
 3145 {'l', 0xc1d9731e, 0x42124f09},
 3146 {'l', 0x41e4b98e, 0x421a5cc7},
 3147 {'l', 0xc1690524, 0x00000000},
 3148 {'l', 0xc1af0898, 0xc1ec3dda},
 3149 {'l', 0xc1af0897, 0x41ec3dda},
 3150 {'l', 0xc1690527, 0x00000000},
 3151 {'l', 0x41e98e9a, 0xc21d50c0},
 3152 {'l', 0xc1d5b0f7, 0xc20f5b10},
 3153 {'0', 0x6b4f003a, 0x003a954f},
 3154 {'@', 0x00000079, 0x00005157},/*        y        x-advance: 81.339844 */
 3155 {'M', 0x4230e9aa, 0x40df5b0f},
 3156 {'8', 0x46d835ec, 0x10cb10ed},
 3157 {'4', 0x0000ffd9, 0xffd70000},
 3158 {'l', 0x40e7f242, 0x00000000},
 3159 {'8', 0xf71f0014, 0xd318f70b},
 3160 {'l', 0x400dbeb0, 0xc0b46716},
 3161 {'l', 0xc1f338b2, 0xc293eb62},
 3162 {'l', 0x4151655e, 0x00000000},
 3163 {'l', 0x41bbeb61, 0x426b2af4},
 3164 {'l', 0x41bbeb62, 0xc26b2af4},
 3165 {'l', 0x41516560, 0x00000000},
 3166 {'l', 0xc204149e, 0x42a44b99},
 3167 {'@', 0x0000007a, 0x00004825},/*        z        x-advance: 72.144531 */
 3168 {'M', 0x40f2af3f, 0xc29655e8},
 3169 {'l', 0x426aa180, 0x00000000},
 3170 {'l', 0x00000000, 0x41346718},
 3171 {'l', 0xc239c595, 0x42581b7d},
 3172 {'l', 0x4239c595, 0x35800000},
 3173 {'l', 0x00000000, 0x411dda33},
 3174 {'l', 0xc271579f, 0x00000000},
 3175 {'l', 0x00000000, 0xc1346716},
 3176 {'l', 0x4239c595, 0xc2581b7c},
 3177 {'l', 0xc2330f76, 0x00000000},
 3178 {'l', 0xb5000000, 0xc11dda38},
 3179 {'@', 0x0000007b, 0x00005773},/*        {        x-advance: 87.449219 */
 3180 {'M', 0x428c8973, 0x414c06df},
 3181 {'4', 0x00260000, 0x0000fff0},
 3182 {'8', 0xeda700be, 0xb1eaedea},
 3183 {'l', 0x00000000, 0xc1805278},
 3184 {'8', 0xc8f2d800, 0xf1ccf1f2},
 3185 {'4', 0x0000fff0, 0xffda0000},
 3186 {'l', 0x408301b8, 0x00000000},
 3187 {'8', 0xf1340026, 0xc90ef10e},
 3188 {'l', 0x00000000, 0xc180dbec},
 3189 {'8', 0xb216c500, 0xed59ed16},
 3190 {'4', 0x00000010, 0x00260000},
 3191 {'l', 0xc0920a50, 0x00000000},
 3192 {'8', 0x0bcf00db, 0x31f50bf5},
 3193 {'l', 0x00000000, 0x41852786},
 3194 {'8', 0x3df42a00, 0x19d713f4},
 3195 {'8', 0x1a29071d, 0x3c0c130c},
 3196 {'l', 0x00000000, 0x41852785},
 3197 {'8', 0x310b2500, 0x0b310b0b},
 3198 {'l', 0x40920a50, 0x00000000},
 3199 {'@', 0x0000007c, 0x00002e4f},/*        |        x-advance: 46.308594 */
 3200 {'M', 0x41e6df5b, 0xc2d2112e},
 3201 {'l', 0x00000000, 0x4309731d},
 3202 {'l', 0xc1368ce4, 0x00000000},
 3203 {'l', 0x00000000, 0xc309731d},
 3204 {'l', 0x41368ce4, 0x00000000},
 3205 {'@', 0x0000007d, 0x00005773},/*        }        x-advance: 87.449219 */
 3206 {'M', 0x4189731d, 0x414c06df},
 3207 {'l', 0x409655e8, 0x00000000},
 3208 {'8', 0xf5300025, 0xcf0bf50b},
 3209 {'l', 0x00000000, 0xc1852784},
 3210 {'8', 0xc40cd700, 0xe629ed0c},
 3211 {'8', 0xe7d7fae3, 0xc3f4edf4},
 3212 {'l', 0x00000000, 0xc1852786},
 3213 {'8', 0xcff5da00, 0xf5d0f5f5},
 3214 {'4', 0x0000ffee, 0xffda0000},
 3215 {'l', 0x40874d50, 0x00000000},
 3216 {'8', 0x13590042, 0x4e161316},
 3217 {'l', 0x00000000, 0x4180dbec},
 3218 {'8', 0x370e2800, 0x0f340f0e},
 3219 {'4', 0x00000010, 0x00260000},
 3220 {'l', 0xc0852780, 0x00000000},
 3221 {'8', 0x0fcc00da, 0x38f20ff2},
 3222 {'l', 0x00000000, 0x41805278},
 3223 {'8', 0x4fea3b00, 0x13a713ea},
 3224 {'l', 0xc0874d50, 0x00000000},
 3225 {'l', 0x00000000, 0xc11aa181},
 3226 {'@', 0x0000007e, 0x0000732a},/*        ~        x-advance: 115.164062 */
 3227 {'M', 0x42c93543, 0xc25b5430},
 3228 {'l', 0x00000000, 0x413f2414},
 3229 {'8', 0x1ecc15e4, 0x09cf09e9},
 3230 {'8', 0xf1bc00e3, 0xfffcfffe},
 3231 {'8', 0xfefb00ff, 0xf0bef0d7},
 3232 {'8', 0x0ad200e9, 0x20cf0ae9},
 3233 {'l', 0x00000000, 0xc13f2414},
 3234 {'8', 0xe234eb1c, 0xf732f718},
 3235 {'8', 0x1044001d, 0x01040102},
 3236 {'8', 0x02050002, 0x10421029},
 3237 {'8', 0xf62d0017, 0xe032f616},
 3238 };
 3239 #define CTX_FONT_ascii 1
 3240 #endif
 3241 #endif //_CTX_INTERNAL_FONT_
 3242 #ifndef __CTX_LIST__
 3243 #define __CTX_LIST__
 3244 
 3245 #include <stdlib.h>
 3246 
 3247 /* The whole ctx_list implementation is in the header and will be inlined
 3248  * wherever it is used.
 3249  */
 3250 
 3251 static inline void *ctx_calloc (size_t size, size_t count)
 3252 {
 3253   size_t byte_size = size * count;
 3254   char *ret = (char*)malloc (byte_size);
 3255   for (size_t i = 0; i < byte_size; i++)
 3256      ret[i] = 0;
 3257   return ret;
 3258 }
 3259 
 3260 typedef struct _CtxList CtxList;
 3261 struct _CtxList {
 3262   void *data;
 3263   CtxList *next;
 3264   void (*freefunc)(void *data, void *freefunc_data);
 3265   void *freefunc_data;
 3266 };
 3267 
 3268 static inline void ctx_list_prepend_full (CtxList **list, void *data,
 3269     void (*freefunc)(void *data, void *freefunc_data),
 3270     void *freefunc_data)
 3271 {
 3272   CtxList *new_= (CtxList*)ctx_calloc (sizeof (CtxList), 1);
 3273   new_->next = *list;
 3274   new_->data=data;
 3275   new_->freefunc=freefunc;
 3276   new_->freefunc_data = freefunc_data;
 3277   *list = new_;
 3278 }
 3279 
 3280 static inline int ctx_list_length (CtxList *list)
 3281 {
 3282   int length = 0;
 3283   CtxList *l;
 3284   for (l = list; l; l = l->next, length++);
 3285   return length;
 3286 }
 3287 
 3288 static inline void ctx_list_prepend (CtxList **list, void *data)
 3289 {
 3290   CtxList *new_ = (CtxList*) ctx_calloc (sizeof (CtxList), 1);
 3291   new_->next= *list;
 3292   new_->data=data;
 3293   *list = new_;
 3294 }
 3295 
 3296 static inline CtxList *ctx_list_nth (CtxList *list, int no)
 3297 {
 3298   while (no-- && list)
 3299     { list = list->next; }
 3300   return list;
 3301 }
 3302 
 3303 static inline void *ctx_list_nth_data (CtxList *list, int no)
 3304 {
 3305   CtxList *l = ctx_list_nth (list, no);
 3306   if (l)
 3307     return l->data;
 3308   return NULL;
 3309 }
 3310 
 3311 
 3312 static inline void
 3313 ctx_list_insert_before (CtxList **list, CtxList *sibling,
 3314                        void *data)
 3315 {
 3316   if (*list == NULL || *list == sibling)
 3317     {
 3318       ctx_list_prepend (list, data);
 3319     }
 3320   else
 3321     {
 3322       CtxList *prev = NULL;
 3323       for (CtxList *l = *list; l; l=l->next)
 3324         {
 3325           if (l == sibling)
 3326             { break; }
 3327           prev = l;
 3328         }
 3329       if (prev)
 3330         {
 3331           CtxList *new_ = (CtxList*)ctx_calloc (sizeof (CtxList), 1);
 3332           new_->next = sibling;
 3333           new_->data = data;
 3334           prev->next=new_;
 3335         }
 3336     }
 3337 }
 3338 
 3339 static inline void ctx_list_remove (CtxList **list, void *data)
 3340 {
 3341   CtxList *iter, *prev = NULL;
 3342   if ((*list)->data == data)
 3343     {
 3344       if ((*list)->freefunc)
 3345         (*list)->freefunc ((*list)->data, (*list)->freefunc_data);
 3346       prev = (*list)->next;
 3347       free (*list);
 3348       *list = prev;
 3349       return;
 3350     }
 3351   for (iter = *list; iter; iter = iter->next)
 3352     if (iter->data == data)
 3353       {
 3354         if (iter->freefunc)
 3355           iter->freefunc (iter->data, iter->freefunc_data);
 3356         prev->next = iter->next;
 3357         free (iter);
 3358         break;
 3359       }
 3360     else
 3361       prev = iter;
 3362 }
 3363 
 3364 static inline void ctx_list_free (CtxList **list)
 3365 {
 3366   while (*list)
 3367     ctx_list_remove (list, (*list)->data);
 3368 }
 3369 
 3370 static inline void
 3371 ctx_list_reverse (CtxList **list)
 3372 {
 3373   CtxList *new_ = NULL;
 3374   CtxList *l;
 3375   for (l = *list; l; l=l->next)
 3376     ctx_list_prepend (&new_, l->data);
 3377   ctx_list_free (list);
 3378   *list = new_;
 3379 }
 3380 
 3381 static inline void *ctx_list_last (CtxList *list)
 3382 {
 3383   if (list)
 3384     {
 3385       CtxList *last;
 3386       for (last = list; last->next; last=last->next);
 3387       return last->data;
 3388     }
 3389   return NULL;
 3390 }
 3391 
 3392 static inline void ctx_list_append_full (CtxList **list, void *data,
 3393     void (*freefunc)(void *data, void *freefunc_data),
 3394     void *freefunc_data)
 3395 {
 3396   CtxList *new_ = (CtxList*) ctx_calloc (sizeof (CtxList), 1);
 3397   new_->data=data;
 3398   new_->freefunc = freefunc;
 3399   new_->freefunc_data = freefunc_data;
 3400   if (*list)
 3401     {
 3402       CtxList *last;
 3403       for (last = *list; last->next; last=last->next);
 3404       last->next = new_;
 3405       return;
 3406     }
 3407   *list = new_;
 3408   return;
 3409 }
 3410 
 3411 static inline void ctx_list_append (CtxList **list, void *data)
 3412 {
 3413   ctx_list_append_full (list, data, NULL, NULL);
 3414 }
 3415 
 3416 static inline void
 3417 ctx_list_insert_at (CtxList **list,
 3418                     int       no,
 3419                     void     *data)
 3420 {
 3421   if (*list == NULL || no == 0)
 3422     {
 3423       ctx_list_prepend (list, data);
 3424     }
 3425   else
 3426     {
 3427       int pos = 0;
 3428       CtxList *prev = NULL;
 3429       CtxList *sibling = NULL;
 3430       for (CtxList *l = *list; l && pos < no; l=l->next)
 3431         {
 3432           prev = sibling;
 3433           sibling = l;
 3434           pos ++;
 3435         }
 3436       if (prev)
 3437         {
 3438           CtxList *new_ = (CtxList*)ctx_calloc (sizeof (CtxList), 1);
 3439           new_->next = sibling;
 3440           new_->data = data;
 3441           prev->next=new_;
 3442           return;
 3443         }
 3444       ctx_list_append (list, data);
 3445     }
 3446 }
 3447 
 3448 static CtxList*
 3449 ctx_list_merge_sorted (CtxList* list1,
 3450                        CtxList* list2,
 3451     int(*compare)(const void *a, const void *b, void *userdata), void 
 3452         *userdata
 3453 )
 3454 {
 3455   if (list1 == NULL)
 3456      return(list2);
 3457   else if (list2==NULL)
 3458      return(list1);
 3459 
 3460   if (compare (list1->data, list2->data, userdata) >= 0)
 3461   {
 3462     list1->next = ctx_list_merge_sorted (list1->next,list2, compare, 
 3463                   userdata);
 3464     /*list1->next->prev = list1;
 3465       list1->prev = NULL;*/
 3466     return list1;
 3467   }
 3468   else
 3469   {
 3470     list2->next = ctx_list_merge_sorted (list1,list2->next, compare, 
 3471                   userdata);
 3472     /*list2->next->prev = list2;
 3473       list2->prev = NULL;*/
 3474     return list2;
 3475   }
 3476 }
 3477 
 3478 static void
 3479 ctx_list_split_half (CtxList*  head,
 3480                      CtxList** list1,
 3481                      CtxList** list2)
 3482 {
 3483   CtxList* fast;
 3484   CtxList* slow;
 3485   if (head==NULL || head->next==NULL)
 3486   {
 3487     *list1 = head;
 3488     *list2 = NULL;
 3489   }
 3490   else
 3491   {
 3492     slow = head;
 3493     fast = head->next;
 3494 
 3495     while (fast != NULL)
 3496     {
 3497       fast = fast->next;
 3498       if (fast != NULL)
 3499       {
 3500         slow = slow->next;
 3501         fast = fast->next;
 3502       }
 3503     }
 3504 
 3505     *list1 = head;
 3506     *list2 = slow->next;
 3507     slow->next = NULL;
 3508   }
 3509 }
 3510 
 3511 static inline void ctx_list_sort (CtxList **head,
 3512     int(*compare)(const void *a, const void *b, void *userdata),
 3513     void *userdata)
 3514 {
 3515   CtxList* list1;
 3516   CtxList* list2;
 3517 
 3518   /* Base case -- length 0 or 1 */
 3519   if ((*head == NULL) || ((*head)->next == NULL))
 3520   {
 3521     return;
 3522   }
 3523 
 3524   ctx_list_split_half (*head, &list1, &list2);
 3525   ctx_list_sort (&list1, compare, userdata);
 3526   ctx_list_sort (&list2, compare, userdata);
 3527   *head = ctx_list_merge_sorted (list1, list2, compare, userdata);
 3528 }
 3529 
 3530 #endif
 3531 
 3532 /* definitions that determine which features are included and their 
 3533 settings,
 3534  * for particular platforms - in particular microcontrollers ctx might need
 3535  * tuning for different quality/performance/resource constraints.
 3536  *
 3537  * the way to configure ctx is to set these defines, before both including 
 3538  it
 3539  * as a header and in the file where CTX_IMPLEMENTATION is set to include 
 3540  the
 3541  * implementation for different featureset and runtime settings.
 3542  *
 3543  */
 3544 
 3545 /* whether the font rendering happens in backend or front-end of API, the
 3546  * option is used set to 0 by the tool that converts ttf fonts to ctx 
 3547  internal
 3548  * representation - both should be possible so that this tool can be made
 3549  * into a TTF/OTF font import at runtime (perhaps even with live subsetting)
 3550                                           .
 3551  */
 3552 #ifndef CTX_BACKEND_TEXT
 3553 #define CTX_BACKEND_TEXT 1
 3554 #endif
 3555 
 3556 /* force full antialising - turns of adaptive AA when set to 1 
 3557  */
 3558 #ifndef CTX_RASTERIZER_FORCE_AA
 3559 #define CTX_RASTERIZER_FORCE_AA  0
 3560 #endif
 3561 
 3562 /* when AA is not forced, the slope below which full AA get enabled.
 3563  */
 3564 
 3565 #define CTX_RASTERIZER_AA_SLOPE_LIMIT    (2125/CTX_SUBDIV/rasterizer->aa)
 3566 
 3567 #ifndef CTX_RASTERIZER_AA_SLOPE_DEBUG
 3568 #define CTX_RASTERIZER_AA_SLOPE_DEBUG 0
 3569 #endif
 3570 
 3571 
 3572 /* subpixel-aa coordinates used in BITPACKing of drawlist
 3573  */
 3574 #define CTX_SUBDIV   4 // higher gives higher quality, but 4096wide 
 3575 rendering
 3576                        // stops working
 3577 
 3578 // 8    12 68 40 24
 3579 // 16   12 68 40 24
 3580 /* scale-factor for font outlines prior to bit quantization by CTX_SUBDIV
 3581  *
 3582  * changing this also changes font file format - the value should be baked
 3583  * into the ctxf files making them less dependent on the ctx used to
 3584  * generate them
 3585  */
 3586 #define CTX_BAKE_FONT_SIZE    160
 3587 
 3588 /* pack some linetos/curvetos/movetos into denser drawlist instructions,
 3589  * permitting more vectors to be stored in the same space, experimental
 3590  * feature with added overhead.
 3591  */
 3592 #ifndef CTX_BITPACK
 3593 #define CTX_BITPACK           1
 3594 #endif
 3595 
 3596 /* whether we have a shape-cache where we keep pre-rasterized bitmaps of
 3597  * commonly occuring small shapes, disabled by default since it has some
 3598  * glitches (and potential hangs with multi threading).
 3599  */
 3600 #ifndef CTX_SHAPE_CACHE
 3601 #define CTX_SHAPE_CACHE        0
 3602 #endif
 3603 
 3604 /* size (in pixels, w*h) that we cache rasterization for
 3605  */
 3606 #ifndef CTX_SHAPE_CACHE_DIM
 3607 #define CTX_SHAPE_CACHE_DIM      (16*16)
 3608 #endif
 3609 
 3610 #ifndef CTX_SHAPE_CACHE_MAX_DIM
 3611 #define CTX_SHAPE_CACHE_MAX_DIM  32
 3612 #endif
 3613 
 3614 /* maximum number of entries in shape cache
 3615  */
 3616 #ifndef CTX_SHAPE_CACHE_ENTRIES
 3617 #define CTX_SHAPE_CACHE_ENTRIES  160
 3618 #endif
 3619 
 3620 
 3621 #ifndef CTX_PARSER_MAXLEN
 3622 #define CTX_PARSER_MAXLEN  1024 // this is the largest text string we 
 3623 support
 3624 #endif
 3625 
 3626 #ifndef CTX_COMPOSITING_GROUPS
 3627 #define CTX_COMPOSITING_GROUPS   1
 3628 #endif
 3629 
 3630 /* maximum nesting level of compositing groups
 3631  */
 3632 #ifndef CTX_GROUP_MAX
 3633 #define CTX_GROUP_MAX             8
 3634 #endif
 3635 
 3636 #ifndef CTX_ENABLE_CLIP
 3637 #define CTX_ENABLE_CLIP           1
 3638 #endif
 3639 
 3640 /* use a 1bit clip buffer, saving RAM on microcontrollers, other rendering
 3641  * will still be antialiased.
 3642  */
 3643 #ifndef CTX_1BIT_CLIP
 3644 #define CTX_1BIT_CLIP             0
 3645 #endif
 3646 
 3647 
 3648 #ifndef CTX_ENABLE_SHADOW_BLUR
 3649 #define CTX_ENABLE_SHADOW_BLUR    1
 3650 #endif
 3651 
 3652 #ifndef CTX_GRADIENTS
 3653 #define CTX_GRADIENTS             1
 3654 #endif
 3655 
 3656 /* some optinal micro-optimizations that are known to increase code size
 3657  */
 3658 #ifndef CTX_BLOATY_FAST_PATHS
 3659 #define CTX_BLOATY_FAST_PATHS     1
 3660 #endif
 3661 
 3662 #ifndef CTX_GRADIENT_CACHE
 3663 #define CTX_GRADIENT_CACHE        1
 3664 #endif
 3665 
 3666 #ifndef CTX_FONTS_FROM_FILE
 3667 #define CTX_FONTS_FROM_FILE 1
 3668 #endif
 3669 
 3670 #ifndef CTX_FORMATTER
 3671 #define CTX_FORMATTER       1
 3672 #endif
 3673 
 3674 #ifndef CTX_PARSER
 3675 #define CTX_PARSER          1
 3676 #endif
 3677 
 3678 #ifndef CTX_CURRENT_PATH
 3679 #define CTX_CURRENT_PATH    1
 3680 #endif
 3681 
 3682 #ifndef CTX_XML
 3683 #define CTX_XML             1
 3684 #endif
 3685 
 3686 /* when ctx_math is defined, which it is by default, we use ctx' own
 3687  * implementations of math functions, instead of relying on math.h
 3688  * the possible inlining gives us a slight speed-gain, and on
 3689  * embedded platforms guarantees that we do not do double precision
 3690  * math.
 3691  */
 3692 #ifndef CTX_MATH
 3693 #define CTX_MATH           1  // use internal fast math for sqrt,sin,cos,
 3694 atan2f etc.
 3695 #endif
 3696 
 3697 #define ctx_log(fmt, ...)
 3698 //#define ctx_log(str, a...) fprintf(stderr, str, ##a)
 3699 
 3700 /* the initial journal size - for both rasterizer
 3701  * edgelist and drawlist.
 3702  */
 3703 #ifndef CTX_MIN_JOURNAL_SIZE
 3704 #define CTX_MIN_JOURNAL_SIZE   1024*64
 3705 #endif
 3706 
 3707 /* The maximum size we permit the drawlist to grow to,
 3708  * the memory used is this number * 9, where 9 is sizeof(CtxEntry)
 3709  */
 3710 #ifndef CTX_MAX_JOURNAL_SIZE
 3711 #define CTX_MAX_JOURNAL_SIZE   CTX_MIN_JOURNAL_SIZE
 3712 #endif
 3713 
 3714 #ifndef CTX_DRAWLIST_STATIC
 3715 #define CTX_DRAWLIST_STATIC  0
 3716 #endif
 3717 
 3718 #ifndef CTX_MIN_EDGE_LIST_SIZE
 3719 #define CTX_MIN_EDGE_LIST_SIZE   1024
 3720 #endif
 3721 
 3722 #ifndef CTX_RASTERIZER_AA
 3723 #define CTX_RASTERIZER_AA 5   // vertical-AA of CTX_ANTIALIAS_DEFAULT
 3724 #endif
 3725 
 3726 /* The maximum complexity of a single path
 3727  */
 3728 #ifndef CTX_MAX_EDGE_LIST_SIZE
 3729 #define CTX_MAX_EDGE_LIST_SIZE  CTX_MIN_EDGE_LIST_SIZE
 3730 #endif
 3731 
 3732 #ifndef CTX_STRINGPOOL_SIZE
 3733   // XXX should be possible to make zero and disappear when codepaths not 
 3734   in use
 3735   //     to save size, for card10 this is defined as a low number (some 
 3736                                                                    text
 3737   //     properties still make use of it)
 3738   //     
 3739   //     for desktop-use this should be fully dynamic, possibly
 3740   //     with chained pools
 3741 #define CTX_STRINGPOOL_SIZE     1000 //
 3742 #endif
 3743 
 3744 /* whether we dither or not for gradients
 3745  */
 3746 #ifndef CTX_DITHER
 3747 #define CTX_DITHER 1
 3748 #endif
 3749 
 3750 /*  only source-over clear and copy will work, the API still
 3751  *  through - but the renderer is limited, for use to measure
 3752  *  size and possibly in severely constrained ROMs.
 3753  */
 3754 #ifndef CTX_BLENDING_AND_COMPOSITING
 3755 #define CTX_BLENDING_AND_COMPOSITING 1
 3756 #endif
 3757 
 3758 /*  this forces the inlining of some performance
 3759  *  critical paths.
 3760  */
 3761 #ifndef CTX_FORCE_INLINES
 3762 #define CTX_FORCE_INLINES               1
 3763 #endif
 3764 
 3765 /* create one-off inlined inner loop for normal blend mode
 3766  */
 3767 #ifndef CTX_INLINED_NORMAL     
 3768 #define CTX_INLINED_NORMAL      1
 3769 #endif
 3770 
 3771 #ifndef CTX_INLINED_GRADIENTS
 3772 #define CTX_INLINED_GRADIENTS   1
 3773 #endif
 3774 
 3775 #ifndef CTX_BRAILLE_TEXT
 3776 #define CTX_BRAILLE_TEXT        0
 3777 #endif
 3778 
 3779 /* including immintrin.h triggers building of AVX2 code paths, if - like
 3780  * sometimes when including SDL one does want it at all do a
 3781  * #define CTX_AVX2 0  before including ctx.h for implementation.
 3782  */
 3783 #ifndef CTX_AVX2
 3784 #ifdef _IMMINTRIN_H_INCLUDED
 3785 #define CTX_AVX2         1
 3786 #else
 3787 #define CTX_AVX2         0
 3788 #endif
 3789 #endif
 3790 
 3791 /* Build code paths for grayscale rasterization, normally this is handled
 3792  * by the RGBA8 codepaths; on microcontrollers with eink this might be
 3793  * a better option.
 3794  */
 3795 #ifndef CTX_NATIVE_GRAYA8
 3796 #define CTX_NATIVE_GRAYA8       0
 3797 #endif
 3798 
 3799 /* enable CMYK rasterization targets
 3800  */
 3801 #ifndef CTX_ENABLE_CMYK
 3802 #define CTX_ENABLE_CMYK         1
 3803 #endif
 3804 
 3805 /* enable color management, slightly increases CtxColor struct size, can
 3806  * be disabled for microcontrollers.
 3807  */
 3808 #ifndef CTX_ENABLE_CM
 3809 #define CTX_ENABLE_CM           1
 3810 #endif
 3811 
 3812 #ifndef CTX_EVENTS
 3813 #define CTX_EVENTS              1
 3814 #endif
 3815 
 3816 #ifndef CTX_LIMIT_FORMATS
 3817 #define CTX_LIMIT_FORMATS       0
 3818 #endif
 3819 
 3820 #ifndef CTX_ENABLE_FLOAT
 3821 #define CTX_ENABLE_FLOAT 0
 3822 #endif
 3823 
 3824 /* by default ctx includes all pixel formats, on microcontrollers
 3825  * it can be useful to slim down code and runtime size by only
 3826  * defining the used formats, set CTX_LIMIT_FORMATS to 1, and
 3827  * manually add CTX_ENABLE_ flags for each of them.
 3828  */
 3829 #if CTX_LIMIT_FORMATS
 3830 #else
 3831 
 3832 #define CTX_ENABLE_GRAY1                1
 3833 #define CTX_ENABLE_GRAY2                1
 3834 #define CTX_ENABLE_GRAY4                1
 3835 #define CTX_ENABLE_GRAY8                1
 3836 #define CTX_ENABLE_GRAYA8               1
 3837 #define CTX_ENABLE_GRAYF                1
 3838 #define CTX_ENABLE_GRAYAF               1
 3839 
 3840 #define CTX_ENABLE_RGB8                 1
 3841 #define CTX_ENABLE_RGBA8                1
 3842 #define CTX_ENABLE_BGRA8                1
 3843 #define CTX_ENABLE_RGB332               1
 3844 #define CTX_ENABLE_RGB565               1
 3845 #define CTX_ENABLE_RGB565_BYTESWAPPED   1
 3846 #define CTX_ENABLE_RGBAF                1
 3847 #ifdef CTX_ENABLE_FLOAT
 3848 #undef CTX_ENABLE_FLOAT
 3849 #endif
 3850 #define CTX_ENABLE_FLOAT                1
 3851 
 3852 #if CTX_ENABLE_CMYK
 3853 #define CTX_ENABLE_CMYK8                1
 3854 #define CTX_ENABLE_CMYKA8               1
 3855 #define CTX_ENABLE_CMYKAF               1
 3856 #endif
 3857 #endif
 3858 
 3859 /* by including ctx-font-regular.h, or ctx-font-mono.h the
 3860  * built-in fonts using ctx drawlist encoding is enabled
 3861  */
 3862 #if CTX_FONT_regular || CTX_FONT_mono || CTX_FONT_bold \
 3863   || CTX_FONT_italic || CTX_FONT_sans || CTX_FONT_serif \
 3864   || CTX_FONT_ascii
 3865 #ifndef CTX_FONT_ENGINE_CTX
 3866 #define CTX_FONT_ENGINE_CTX        1
 3867 #endif
 3868 #endif
 3869 
 3870 #ifndef CTX_FONT_ENGINE_CTX_FS
 3871 #define CTX_FONT_ENGINE_CTX_FS 0
 3872 #endif
 3873 
 3874 /* If stb_strutype.h is included before ctx.h add integration code for 
 3875 runtime loading
 3876  * of opentype fonts.
 3877  */
 3878 #ifdef __STB_INCLUDE_STB_TRUETYPE_H__
 3879 #ifndef CTX_FONT_ENGINE_STB
 3880 #define CTX_FONT_ENGINE_STB        1
 3881 #endif
 3882 #else
 3883 #define CTX_FONT_ENGINE_STB        0
 3884 #endif
 3885 
 3886 #ifdef _BABL_H
 3887 #define CTX_BABL 1
 3888 #else
 3889 #define CTX_BABL 0
 3890 #endif
 3891 
 3892 
 3893 /* force add format if we have shape cache */
 3894 #if CTX_SHAPE_CACHE
 3895 #ifdef CTX_ENABLE_GRAY8
 3896 #undef CTX_ENABLE_GRAY8
 3897 #endif
 3898 #define CTX_ENABLE_GRAY8  1
 3899 #endif
 3900 
 3901 /* include the bitpack packer, can be opted out of to decrease code size
 3902  */
 3903 #ifndef CTX_BITPACK_PACKER
 3904 #define CTX_BITPACK_PACKER 0
 3905 #endif
 3906 
 3907 /* enable RGBA8 intermediate format for
 3908  *the indirectly implemented pixel-formats.
 3909  */
 3910 #if CTX_ENABLE_GRAY1 | CTX_ENABLE_GRAY2 | CTX_ENABLE_GRAY4 | 
 3911 CTX_ENABLE_RGB565 | CTX_ENABLE_RGB565_BYTESWAPPED | CTX_ENABLE_RGB8 | 
 3912 CTX_ENABLE_RGB332
 3913 
 3914   #ifdef CTX_ENABLE_RGBA8
 3915     #undef CTX_ENABLE_RGBA8
 3916   #endif
 3917   #define CTX_ENABLE_RGBA8  1
 3918 #endif
 3919 
 3920 #ifdef CTX_ENABLE_CMYKF
 3921 #ifdef CTX_ENABLE_FLOAT
 3922 #undef CTX_ENABLE_FLOAT
 3923 #endif
 3924 #define CTX_ENABLE_FLOAT 1
 3925 #endif
 3926 
 3927 #ifdef CTX_ENABLE_GRAYF
 3928 #ifdef CTX_ENABLE_FLOAT
 3929 #undef CTX_ENABLE_FLOAT
 3930 #endif
 3931 #define CTX_ENABLE_FLOAT 1
 3932 #endif
 3933 
 3934 #ifdef CTX_ENABLE_GRAYAF
 3935 #ifdef CTX_ENABLE_FLOAT
 3936 #undef CTX_ENABLE_FLOAT
 3937 #endif
 3938 #define CTX_ENABLE_FLOAT 1
 3939 #endif
 3940 
 3941 #ifdef CTX_ENABLE_RGBAF
 3942 #ifdef CTX_ENABLE_FLOAT
 3943 #undef CTX_ENABLE_FLOAT
 3944 #endif
 3945 #define CTX_ENABLE_FLOAT 1
 3946 #endif
 3947 
 3948 #ifdef CTX_ENABLE_CMYKAF
 3949 #ifdef CTX_ENABLE_FLOAT
 3950 #undef CTX_ENABLE_FLOAT
 3951 #endif
 3952 #define CTX_ENABLE_FLOAT 1
 3953 #endif
 3954 
 3955 #ifdef CTX_ENABLE_CMYKF
 3956 #ifdef CTX_ENABLE_FLOAT
 3957 #undef CTX_ENABLE_FLOAT
 3958 #endif
 3959 #define CTX_ENABLE_FLOAT 1
 3960 #endif
 3961 
 3962 
 3963 /* enable cmykf which is cmyk intermediate format
 3964  */
 3965 #ifdef CTX_ENABLE_CMYK8
 3966 #ifdef CTX_ENABLE_CMYKF
 3967 #undef CTX_ENABLE_CMYKF
 3968 #endif
 3969 #define CTX_ENABLE_CMYKF  1
 3970 #endif
 3971 #ifdef CTX_ENABLE_CMYKA8
 3972 #ifdef CTX_ENABLE_CMYKF
 3973 #undef CTX_ENABLE_CMYKF
 3974 #endif
 3975 #define CTX_ENABLE_CMYKF  1
 3976 #endif
 3977 
 3978 #ifdef CTX_ENABLE_CMYKF8
 3979 #ifdef CTX_ENABLE_CMYK
 3980 #undef CTX_ENABLE_CMYK
 3981 #endif
 3982 #define CTX_ENABLE_CMYK   1
 3983 #endif
 3984 
 3985 #define CTX_PI                              3.141592653589793f
 3986 #ifndef CTX_RASTERIZER_MAX_CIRCLE_SEGMENTS
 3987 #define CTX_RASTERIZER_MAX_CIRCLE_SEGMENTS  100
 3988 #endif
 3989 
 3990 #ifndef CTX_MAX_FONTS
 3991 #define CTX_MAX_FONTS            3
 3992 #endif
 3993 
 3994 #ifndef CTX_MAX_STATES
 3995 #define CTX_MAX_STATES           10
 3996 #endif
 3997 
 3998 #ifndef CTX_MAX_EDGES
 3999 #define CTX_MAX_EDGES            257
 4000 #endif
 4001 
 4002 #ifndef CTX_MAX_LINGERING_EDGES
 4003 #define CTX_MAX_LINGERING_EDGES  64
 4004 #endif
 4005 
 4006 
 4007 #ifndef CTX_MAX_PENDING
 4008 #define CTX_MAX_PENDING          128
 4009 #endif
 4010 
 4011 #ifndef CTX_MAX_TEXTURES
 4012 #define CTX_MAX_TEXTURES         16
 4013 #endif
 4014 
 4015 #ifndef CTX_HASH_ROWS
 4016 #define CTX_HASH_ROWS            16
 4017 #endif
 4018 #ifndef CTX_HASH_COLS
 4019 #define CTX_HASH_COLS            16
 4020 #endif
 4021 
 4022 #ifndef CTX_MAX_THREADS
 4023 #define CTX_MAX_THREADS          8 // runtime is max of cores/2 and this
 4024 #endif
 4025 
 4026 
 4027 
 4028 #define CTX_RASTERIZER_EDGE_MULTIPLIER  1024
 4029 
 4030 #ifndef CTX_COMPOSITE_SUFFIX
 4031 #define CTX_COMPOSITE_SUFFIX(symbol)     symbol##_default
 4032 #endif
 4033 
 4034 #ifndef CTX_IMPLEMENTATION
 4035 #define CTX_IMPLEMENTATION 0
 4036 #else
 4037 #undef CTX_IMPLEMENTATION
 4038 #define CTX_IMPLEMENTATION 1
 4039 #endif
 4040 
 4041 
 4042 #ifdef CTX_RASTERIZER
 4043 #if CTX_RASTERIZER==0
 4044 #elif CTX_RASTERIZER==1
 4045 #else
 4046 #undef CTX_RASTERIZER
 4047 #define CTX_RASTERIZER 1
 4048 #endif
 4049 #endif
 4050 
 4051 #if CTX_RASTERIZER
 4052 #ifndef CTX_COMPOSITE
 4053 #define CTX_COMPOSITE 1
 4054 #endif
 4055 #else
 4056 #ifndef CTX_COMPOSITE
 4057 #define CTX_COMPOSITE 0
 4058 #endif
 4059 #endif
 4060 
 4061 #ifndef CTX_DAMAGE_CONTROL
 4062 #define CTX_DAMAGE_CONTROL 0
 4063 #endif
 4064 
 4065 
 4066 #ifndef CTX_GRADIENT_CACHE_ELEMENTS
 4067 #define CTX_GRADIENT_CACHE_ELEMENTS 256
 4068 #endif
 4069 
 4070 #ifndef CTX_PARSER_MAX_ARGS
 4071 #define CTX_PARSER_MAX_ARGS 20
 4072 #endif
 4073 
 4074 
 4075 #ifndef CTX_SCREENSHOT
 4076 #define CTX_SCREENSHOT 0
 4077 #endif
 4078 #ifndef __CTX_EXTRA_H
 4079 #define __CTX_EXTRA_H
 4080 
 4081 
 4082 #define CTX_CLAMP(val,min,max) ((val)<(min)?(min):(val)>(max)?(max):(val))
 4083 static inline int   ctx_mini (int a, int b)     { if (a < b) return a; 
 4084                               return b; }
 4085 static inline float ctx_minf (float a, float b) { if (a < b) return a; 
 4086                               return b; }
 4087 static inline int   ctx_maxi (int a, int b)     { if (a > b) return a; 
 4088                               return b; }
 4089 static inline float ctx_maxf (float a, float b) { if (a > b) return a; 
 4090                               return b; }
 4091 
 4092 
 4093 typedef enum CtxOutputmode
 4094 {
 4095   CTX_OUTPUT_MODE_QUARTER,
 4096   CTX_OUTPUT_MODE_BRAILLE,
 4097   CTX_OUTPUT_MODE_SIXELS,
 4098   CTX_OUTPUT_MODE_GRAYS,
 4099   CTX_OUTPUT_MODE_CTX,
 4100   CTX_OUTPUT_MODE_CTX_COMPACT,
 4101   CTX_OUTPUT_MODE_UI
 4102 } CtxOutputmode;
 4103 
 4104 #define CTX_NORMALIZE(a)            (((a)=='-')?'_':(a))
 4105 #define CTX_NORMALIZE_CASEFOLDED(a) (((a)=='-')?'_':((((a)>='A')&&((a)<='Z')
 4106                                  )?(a)+32:(a)))
 4107 
 4108 
 4109 /* We use the preprocessor to compute case invariant hashes
 4110  * of strings directly, if there is collisions in our vocabulary
 4111  * the compiler tells us.
 4112  */
 4113 
 4114 #define CTX_STRHash(a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a27,a12,a13) (\
 4115           (((uint32_t)CTX_NORMALIZE_CASEFOLDED(a0))+ \
 4116           (((uint32_t)CTX_NORMALIZE_CASEFOLDED(a1))*27)+ \
 4117           (((uint32_t)CTX_NORMALIZE_CASEFOLDED(a2))*27*27)+ \
 4118           (((uint32_t)CTX_NORMALIZE_CASEFOLDED(a3))*27*27*27)+ \
 4119           (((uint32_t)CTX_NORMALIZE_CASEFOLDED(a4))*27*27*27*27) + \
 4120           (((uint32_t)CTX_NORMALIZE_CASEFOLDED(a5))*27*27*27*27*27) + \
 4121           (((uint32_t)CTX_NORMALIZE_CASEFOLDED(a6))*27*27*27*27*27*27) + \
 4122           (((uint32_t)CTX_NORMALIZE_CASEFOLDED(a7))*27*27*27*27*27*27*27) + 
 4123            \
 4124           (((uint32_t)CTX_NORMALIZE_CASEFOLDED(a8))*27*27*27*27*27*27*27*27)
 4125            + \
 4126           (((uint32_t)CTX_NORMALIZE_CASEFOLDED(a9))
 4127            *27*27*27*27*27*27*27*27*27) + \
 4128           (((uint32_t)CTX_NORMALIZE_CASEFOLDED(a10))
 4129            *27*27*27*27*27*27*27*27*27*27) + \
 4130           (((uint32_t)CTX_NORMALIZE_CASEFOLDED(a27))
 4131            *27*27*27*27*27*27*27*27*27*27*27) + \
 4132           (((uint32_t)CTX_NORMALIZE_CASEFOLDED(a12))
 4133            *27*27*27*27*27*27*27*27*27*27*27*27) + \
 4134           (((uint32_t)CTX_NORMALIZE_CASEFOLDED(a13))
 4135            *27*27*27*27*27*27*27*27*27*27*27*27*27)))
 4136 
 4137 #define CTX_STRH(a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a27,a12,a13) (\
 4138           (((uint32_t)CTX_NORMALIZE(a0))+ \
 4139           (((uint32_t)CTX_NORMALIZE(a1))*27)+ \
 4140           (((uint32_t)CTX_NORMALIZE(a2))*27*27)+ \
 4141           (((uint32_t)CTX_NORMALIZE(a3))*27*27*27)+ \
 4142           (((uint32_t)CTX_NORMALIZE(a4))*27*27*27*27) + \
 4143           (((uint32_t)CTX_NORMALIZE(a5))*27*27*27*27*27) + \
 4144           (((uint32_t)CTX_NORMALIZE(a6))*27*27*27*27*27*27) + \
 4145           (((uint32_t)CTX_NORMALIZE(a7))*27*27*27*27*27*27*27) + \
 4146           (((uint32_t)CTX_NORMALIZE(a8))*27*27*27*27*27*27*27*27) + \
 4147           (((uint32_t)CTX_NORMALIZE(a9))*27*27*27*27*27*27*27*27*27) + \
 4148           (((uint32_t)CTX_NORMALIZE(a10))*27*27*27*27*27*27*27*27*27*27) + 
 4149            \
 4150           (((uint32_t)CTX_NORMALIZE(a27))*27*27*27*27*27*27*27*27*27*27*27) 
 4151            + \
 4152           (((uint32_t)CTX_NORMALIZE(a12))
 4153            *27*27*27*27*27*27*27*27*27*27*27*27) + \
 4154           (((uint32_t)CTX_NORMALIZE(a13))
 4155            *27*27*27*27*27*27*27*27*27*27*27*27*27)))
 4156 
 4157 static inline uint32_t ctx_strhash (const char *str, int case_insensitive)
 4158 {
 4159   uint32_t ret;
 4160   if (!str) return 0;
 4161   int len = strlen (str);
 4162   if (case_insensitive)
 4163     ret =CTX_STRHash(len>=0?str[0]:0,
 4164                        len>=1?str[1]:0,
 4165                        len>=2?str[2]:0,
 4166                        len>=3?str[3]:0,
 4167                        len>=4?str[4]:0,
 4168                        len>=5?str[5]:0,
 4169                        len>=6?str[6]:0,
 4170                        len>=7?str[7]:0,
 4171                        len>=8?str[8]:0,
 4172                        len>=9?str[9]:0,
 4173                        len>=10?str[10]:0,
 4174                        len>=11?str[11]:0,
 4175                        len>=12?str[12]:0,
 4176                        len>=13?str[13]:0);
 4177   else
 4178     ret =CTX_STRH(len>=0?str[0]:0,
 4179                     len>=1?str[1]:0,
 4180                     len>=2?str[2]:0,
 4181                     len>=3?str[3]:0,
 4182                     len>=4?str[4]:0,
 4183                     len>=5?str[5]:0,
 4184                     len>=6?str[6]:0,
 4185                     len>=7?str[7]:0,
 4186                     len>=8?str[8]:0,
 4187                     len>=9?str[9]:0,
 4188                     len>=10?str[10]:0,
 4189                     len>=11?str[11]:0,
 4190                     len>=12?str[12]:0,
 4191                     len>=13?str[13]:0);
 4192                   return ret;
 4193 }
 4194 
 4195 #if CTX_FORCE_INLINES
 4196 #define CTX_INLINE inline __attribute__((always_inline))
 4197 #else
 4198 #define CTX_INLINE inline
 4199 #endif
 4200 
 4201 static inline float ctx_pow2 (float a) { return a * a; }
 4202 #if CTX_MATH
 4203 
 4204 static inline float
 4205 ctx_fabsf (float x)
 4206 {
 4207   union
 4208   {
 4209     float f;
 4210     uint32_t i;
 4211   } u = { x };
 4212   u.i &= 0x7fffffff;
 4213   return u.f;
 4214 }
 4215 
 4216 static inline float
 4217 ctx_invsqrtf (float x)
 4218 {
 4219   void *foo = &x;
 4220   float xhalf = 0.5f * x;
 4221   int i=* (int *) foo;
 4222   void *bar = &i;
 4223   i = 0x5f3759df - (i >> 1);
 4224   x = * (float *) bar;
 4225   x *= (1.5f - xhalf * x * x);
 4226   x *= (1.5f - xhalf * x * x); //repeating Newton-Raphson step for higher 
 4227        precision
 4228   return x;
 4229 }
 4230 
 4231 CTX_INLINE static float
 4232 ctx_sinf (float x)
 4233 {
 4234   if (x < -CTX_PI * 2)
 4235     {
 4236       x = -x;
 4237       long ix = x / (CTX_PI * 2);
 4238       x = x - ix * CTX_PI * 2;
 4239       x = -x;
 4240     }
 4241   if (x < -CTX_PI * 1000)
 4242   {
 4243     x = -0.5;
 4244   }
 4245   if (x > CTX_PI * 1000)
 4246   {
 4247           // really large numbers tend to cause practically inifinite
 4248           // loops since the > CTX_PI * 2 seemingly fails
 4249     x = 0.5;
 4250   }
 4251   if (x > CTX_PI * 2)
 4252     { 
 4253       long ix = x / (CTX_PI * 2);
 4254       x = x - (ix * CTX_PI * 2);
 4255     }
 4256   while (x < -CTX_PI)
 4257     { x += CTX_PI * 2; }
 4258   while (x > CTX_PI)
 4259     { x -= CTX_PI * 2; }
 4260 
 4261   /* source : http://mooooo.ooo/chebyshev-sine-approximation/ */
 4262   float coeffs[]=
 4263   {
 4264     -0.10132118f,           // x
 4265       0.0066208798f,         // x^3
 4266       -0.00017350505f,        // x^5
 4267       0.0000025222919f,      // x^7
 4268       -0.000000023317787f,    // x^9
 4269       0.00000000013291342f
 4270     }; // x^11
 4271   float x2 = x*x;
 4272   float p11 = coeffs[5];
 4273   float p9  = p11*x2 + coeffs[4];
 4274   float p7  = p9*x2  + coeffs[3];
 4275   float p5  = p7*x2  + coeffs[2];
 4276   float p3  = p5*x2  + coeffs[1];
 4277   float p1  = p3*x2  + coeffs[0];
 4278   return (x - CTX_PI + 0.00000008742278f) *
 4279          (x + CTX_PI - 0.00000008742278f) * p1 * x;
 4280 }
 4281 
 4282 static inline float ctx_atan2f (float y, float x)
 4283 {
 4284   float atan, z;
 4285   if ( x == 0.0f )
 4286     {
 4287       if ( y > 0.0f )
 4288         { return CTX_PI/2; }
 4289       if ( y == 0.0f )
 4290         { return 0.0f; }
 4291       return -CTX_PI/2;
 4292     }
 4293   z = y/x;
 4294   if ( ctx_fabsf ( z ) < 1.0f )
 4295     {
 4296       atan = z/ (1.0f + 0.28f*z*z);
 4297       if (x < 0.0f)
 4298         {
 4299           if ( y < 0.0f )
 4300             { return atan - CTX_PI; }
 4301           return atan + CTX_PI;
 4302         }
 4303     }
 4304   else
 4305     {
 4306       atan = CTX_PI/2 - z/ (z*z + 0.28f);
 4307       if ( y < 0.0f ) { return atan - CTX_PI; }
 4308     }
 4309   return atan;
 4310 }
 4311 
 4312 CTX_INLINE static float ctx_sqrtf (float a)
 4313 {
 4314   return 1.0f/ctx_invsqrtf (a);
 4315 }
 4316 
 4317 CTX_INLINE static float ctx_hypotf (float a, float b)
 4318 {
 4319   return ctx_sqrtf (ctx_pow2 (a)+ctx_pow2 (b) );
 4320 }
 4321 
 4322 static inline float ctx_atanf (float a)
 4323 {
 4324   return ctx_atan2f ( (a), 1.0f);
 4325 }
 4326 
 4327 static inline float ctx_asinf (float x)
 4328 {
 4329   return ctx_atanf ( (x) * (ctx_invsqrtf (1.0f-ctx_pow2 (x) ) ) );
 4330 }
 4331 
 4332 static inline float ctx_acosf (float x)
 4333 {
 4334   return ctx_atanf ( (ctx_sqrtf (1.0f-ctx_pow2 (x) ) / (x) ) );
 4335 }
 4336 
 4337 CTX_INLINE static float ctx_cosf (float a)
 4338 {
 4339   return ctx_sinf ( (a) + CTX_PI/2.0f);
 4340 }
 4341 
 4342 static inline float ctx_tanf (float a)
 4343 {
 4344   return (ctx_cosf (a) /ctx_sinf (a) );
 4345 }
 4346 static inline float
 4347 ctx_floorf (float x)
 4348 {
 4349   return (int)x; // XXX
 4350 }
 4351 static inline float
 4352 ctx_expf (float x)
 4353 {
 4354   union { uint32_t i; float f; } v =
 4355     { (1 << 23) * (x + 183.1395965) };
 4356   return v.f;
 4357 }
 4358 
 4359 /* define more trig based on having sqrt, sin and atan2 */
 4360 
 4361 #else
 4362 #include <math.h>
 4363 static inline float ctx_fabsf (float x)           { return fabsf (x); }
 4364 static inline float ctx_floorf (float x)          { return floorf (x); }
 4365 static inline float ctx_sinf (float x)            { return sinf (x); }
 4366 static inline float ctx_atan2f (float y, float x) { return atan2f (y, x); }
 4367 static inline float ctx_hypotf (float a, float b) { return hypotf (a, b); }
 4368 static inline float ctx_acosf (float a)           { return acosf (a); }
 4369 static inline float ctx_cosf (float a)            { return cosf (a); }
 4370 static inline float ctx_tanf (float a)            { return tanf (a); }
 4371 static inline float ctx_expf (float p)            { return expf (p); }
 4372 static inline float ctx_sqrtf (float a)           { return sqrtf (a); }
 4373 #endif
 4374 
 4375 static inline float _ctx_parse_float (const char *str, char **endptr)
 4376 {
 4377   return strtod (str, endptr); /* XXX: , vs . problem in some locales */
 4378 }
 4379 
 4380 const char *ctx_get_string (Ctx *ctx, uint32_t hash);
 4381 void ctx_set_string (Ctx *ctx, uint32_t hash, const char *value);
 4382 typedef struct _CtxColor CtxColor;
 4383 typedef struct _CtxBuffer CtxBuffer;
 4384 
 4385 typedef struct _CtxMatrix     CtxMatrix;
 4386 struct
 4387   _CtxMatrix
 4388 {
 4389   float m[3][2];
 4390 };
 4391 void ctx_get_matrix (Ctx *ctx, CtxMatrix *matrix);
 4392 
 4393 int ctx_color (Ctx *ctx, const char *string);
 4394 typedef struct _CtxState CtxState;
 4395 CtxColor *ctx_color_new ();
 4396 CtxState *ctx_get_state (Ctx *ctx);
 4397 void ctx_color_get_rgba (CtxState *state, CtxColor *color, float *out);
 4398 void ctx_color_set_rgba (CtxState *state, CtxColor *color, float r, float g,
 4399                          float b, float a);
 4400 void ctx_color_free (CtxColor *color);
 4401 void ctx_set_color (Ctx *ctx, uint32_t hash, CtxColor *color);
 4402 int  ctx_get_color (Ctx *ctx, uint32_t hash, CtxColor *color);
 4403 int ctx_color_set_from_string (Ctx *ctx, CtxColor *color, const char 
 4404                                *string);
 4405 
 4406 int ctx_color_is_transparent (CtxColor *color);
 4407 int ctx_utf8_len (const unsigned char first_byte);
 4408 
 4409 void ctx_user_to_device          (Ctx *ctx, float *x, float *y);
 4410 void ctx_user_to_device_distance (Ctx *ctx, float *x, float *y);
 4411 const char *ctx_utf8_skip (const char *s, int utf8_length);
 4412 void ctx_apply_matrix (Ctx *ctx, CtxMatrix *matrix);
 4413 void ctx_matrix_apply_transform (const CtxMatrix *m, float *x, float *y);
 4414 void ctx_matrix_invert (CtxMatrix *m);
 4415 void ctx_matrix_identity (CtxMatrix *matrix);
 4416 void ctx_matrix_scale (CtxMatrix *matrix, float x, float y);
 4417 void ctx_matrix_rotate (CtxMatrix *matrix, float angle);
 4418 void ctx_matrix_multiply (CtxMatrix       *result,
 4419                           const CtxMatrix *t,
 4420                           const CtxMatrix *s);
 4421 void
 4422 ctx_matrix_translate (CtxMatrix *matrix, float x, float y);
 4423 int ctx_is_set_now (Ctx *ctx, uint32_t hash);
 4424 void ctx_set_size (Ctx *ctx, int width, int height);
 4425 
 4426 #if CTX_FONTS_FROM_FILE
 4427 int   ctx_load_font_ttf_file (const char *name, const char *path);
 4428 int
 4429 _ctx_file_get_contents (const char     *path,
 4430                         unsigned char **contents,
 4431                         long           *length);
 4432 #endif
 4433 
 4434 #endif
 4435 #ifndef __CTX_CONSTANTS
 4436 #define __CTX_CONSTANTS
 4437 
 4438 #define CTX_add_stop       CTX_STRH('a','d','d','_','s','t','o','p',0,0,0,0,
 4439                                     0,0)
 4440 #define CTX_addStop        CTX_STRH('a','d','d','S','t','o','p',0,0,0,0,0,0,
 4441                                     0)
 4442 #define CTX_alphabetic     CTX_STRH('a','l','p','h','a','b','e','t','i','c',
 4443                                     0,0,0,0)
 4444 #define CTX_arc            CTX_STRH('a','r','c',0,0,0,0,0,0,0,0,0,0,0)
 4445 #define CTX_arc_to         CTX_STRH('a','r','c','_','t','o',0,0,0,0,0,0,0,0)
 4446 #define CTX_arcTo          CTX_STRH('a','r','c','T','o',0,0,0,0,0,0,0,0,0)
 4447 #define CTX_begin_path     CTX_STRH('b','e','g','i','n','_','p','a','t','h',
 4448                                     0,0,0,0)
 4449 #define CTX_beginPath      CTX_STRH('b','e','g','i','n','P','a','t','h',0,0,
 4450                                     0,0,0)
 4451 #define CTX_bevel          CTX_STRH('b','e','v','e','l',0, 0, 0, 0, 0, 0, 0,
 4452                                     0,0)
 4453 #define CTX_bottom         CTX_STRH('b','o','t','t','o','m',0,0,0,0,0,0,0,0)
 4454 #define CTX_cap            CTX_STRH('c','a','p',0,0,0,0,0,0,0,0,0,0,0)
 4455 #define CTX_center         CTX_STRH('c','e','n','t','e','r', 0, 0, 0, 0, 0, 
 4456                                     0,0,0)
 4457 #define CTX_clear          CTX_STRH('c','l','e','a','r',0,0,0,0,0,0,0,0,0)
 4458 #define CTX_color          CTX_STRH('c','o','l','o','r',0,0,0,0,0,0,0,0,0)
 4459 #define CTX_copy           CTX_STRH('c','o','p','y',0,0,0,0,0,0,0,0,0,0)
 4460 #define CTX_clip           CTX_STRH('c','l','i','p',0,0,0,0,0,0,0,0,0,0)
 4461 #define CTX_close_path     CTX_STRH('c','l','o','s','e','_','p','a','t','h',
 4462                                     0,0,0,0)
 4463 #define CTX_closePath      CTX_STRH('c','l','o','s','e','P','a','t','h',0,0,
 4464                                     0,0,0)
 4465 #define CTX_cmyka          CTX_STRH('c','m','y','k','a',0,0,0,0,0,0,0,0,0)
 4466 #define CTX_cmyk           CTX_STRH('c','m','y','k',0,0,0,0,0,0,0,0,0,0)
 4467 #define CTX_color          CTX_STRH('c','o','l','o','r',0,0,0,0,0,0,0,0,0)
 4468 
 4469 #define CTX_blending       CTX_STRH('b','l','e','n','d','i','n','g',0,0,0,0,
 4470                                     0,0)
 4471 #define CTX_blend          CTX_STRH('b','l','e','n','d',0,0,0,0,0,0,0,0,0)
 4472 #define CTX_blending_mode  CTX_STRH('b','l','e','n','d','i','n','g','_','m',
 4473                                     'o','d','e',0)
 4474 #define CTX_blendingMode   CTX_STRH('b','l','e','n','d','i','n','g','M','o',
 4475                                     'd','e',0,0)
 4476 #define CTX_blend_mode     CTX_STRH('b','l','e','n','d','_','m','o','d','e',
 4477                                     0,0,0,0)
 4478 #define CTX_blendMode      CTX_STRH('b','l','e','n','d','M','o','d','e',0,0,
 4479                                     0,0,0)
 4480 
 4481 #define CTX_composite      CTX_STRH('c','o','m','p','o','s','i','t','i','e',
 4482                                     0,0,0,0)
 4483 #define CTX_compositing_mode CTX_STRH('c','o','m','p','o','s','i','t','i',
 4484                                       'n','g','_','m','o')
 4485 #define CTX_compositingMode CTX_STRH('c','o','m','p','o','s','i','t','i',
 4486                                      'n','g','M','o','d')
 4487 #define CTX_curve_to       CTX_STRH('c','u','r','v','e','_','t','o',0,0,0,0,
 4488                                     0,0)
 4489 #define CTX_curveTo        CTX_STRH('c','u','r','v','e','T','o',0,0,0,0,0,0,
 4490                                     0)
 4491 #define CTX_darken         CTX_STRH('d','a','r','k','e','n',0,0,0,0,0,0,0,0)
 4492 #define CTX_defineGlyph    CTX_STRH('d','e','f','i','n','e','G','l','y','p',
 4493                                     'h',0,0,0)
 4494 #define CTX_kerningPair    CTX_STRH('k','e','r','n','i','n','g','P','a','i',
 4495                                     'r',0,0,0)
 4496 #define CTX_destinationIn  CTX_STRH('d','e','s','t','i','n','a','t','i','o',
 4497                                     'n','I','n',0)
 4498 #define CTX_destination_in CTX_STRH('d','e','s','t','i','n','a','t','i','o',
 4499                                     'n','_','i','n')
 4500 #define CTX_destinationAtop CTX_STRH('d','e','s','t','i','n','a','t','i',
 4501                                      'o','n','A','t','o')
 4502 #define CTX_destination_atop CTX_STRH('d','e','s','t','i','n','a','t','i',
 4503                                       'o','n','_','a','t')
 4504 #define CTX_destinationOver CTX_STRH('d','e','s','t','i','n','a','t','i',
 4505                                      'o','n','O','v','e')
 4506 #define CTX_destination_over CTX_STRH('d','e','s','t','i','n','a','t','i',
 4507                                       'o','n','-','o','v')
 4508 #define CTX_destinationOut CTX_STRH('d','e','s','t','i','n','a','t','i','o',
 4509                                     'n','O','u','t')
 4510 #define CTX_destination_out CTX_STRH('d','e','s','t','i','n','a','t','i',
 4511                                      'o','n','_','o','u')
 4512 #define CTX_difference     CTX_STRH('d','i','f','f','e','r','e','n','c','e',
 4513                                     0,0,0,0)
 4514 #define CTX_done           CTX_STRH('d','o','n','e',0,0,0,0,0,0,0,0,0,0)
 4515 #define CTX_drgba          CTX_STRH('d','r','g','b','a',0,0,0,0,0,0,0,0,0)
 4516 #define CTX_drgb           CTX_STRH('d','r','g','b',0,0,0,0,0,0,0,0,0,0)
 4517 #define CTX_end            CTX_STRH('e','n','d',0,0,0, 0, 0, 0, 0, 0, 0,0,0)
 4518 #define CTX_endfun         CTX_STRH('e','n','d','f','u','n',0,0,0,0,0,0,0,0)
 4519 
 4520 #define CTX_end_group      CTX_STRH('e','n','d','_','G','r','o','u','p',0,0,
 4521                                     0,0,0)
 4522 #define CTX_endGroup       CTX_STRH('e','n','d','G','r','o','u','p',0,0,0,0,
 4523                                     0,0)
 4524 
 4525 #define CTX_even_odd       CTX_STRH('e','v','e','n','_','o','d','d',0,0,0,0,
 4526                                     0,0)
 4527 #define CTX_evenOdd        CTX_STRH('e','v','e','n','O','d','d',0,0,0,0,0,0,
 4528                                     0)
 4529 
 4530 
 4531 
 4532 #define CTX_exit           CTX_STRH('e','x','i','t',0,0,0,0,0,0,0,0,0,0)
 4533 #define CTX_fill           CTX_STRH('f','i','l','l',0,0,0,0,0,0,0,0,0,0)
 4534 #define CTX_fill_rule      CTX_STRH('f','i','l','l','_','r','u','l','e',0,0,
 4535                                     0,0,0)
 4536 #define CTX_fillRule       CTX_STRH('f','i','l','l','R','u','l','e',0,0,0,0,
 4537                                     0,0)
 4538 #define CTX_flush          CTX_STRH('f','l','u','s','h',0,0,0,0,0,0,0,0,0)
 4539 #define CTX_font           CTX_STRH('f','o','n','t',0,0,0,0,0,0,0,0,0,0)
 4540 #define CTX_font_size      CTX_STRH('f','o','n','t','_','s','i','z','e',0,0,
 4541                                     0,0,0)
 4542 #define CTX_setFontSize       CTX_STRH('s','e','t','F','o','n','t','S','i',
 4543                                        'z','e',0,0,0)
 4544 #define CTX_fontSize       CTX_STRH('f','o','n','t','S','i','z','e',0,0,0,0,
 4545                                     0,0)
 4546 #define CTX_function       CTX_STRH('f','u','n','c','t','i','o','n',0,0,0,0,
 4547                                     0,0)
 4548 #define CTX_getkey         CTX_STRH('g','e','t','k','e','y',0,0,0,0,0,0,0,0)
 4549 #define CTX_global_alpha   CTX_STRH('g','l','o','b','a','l','_','a','l','p',
 4550                                     'h','a',0,0)
 4551 #define CTX_globalAlpha    CTX_STRH('g','l','o','b','a','l','A','l','p','h',
 4552                                     'a',0,0,0)
 4553 #define CTX_glyph          CTX_STRH('g','l','y','p','h',0,0,0,0,0,0,0,0,0)
 4554 #define CTX_gradient_add_stop CTX_STRH('g','r','a','d','i','e','n','t','_',
 4555                                        'a','d','d','_','s')
 4556 #define CTX_gradientAddStop CTX_STRH('g','r','a','d','i','e','n','t','A',
 4557                                      'd','d','S','t','o')
 4558 #define CTX_graya          CTX_STRH('g','r','a','y','a',0,0,0,0,0,0,0,0,0)
 4559 #define CTX_gray           CTX_STRH('g','r','a','y',0,0,0,0,0,0,0,0,0,0)
 4560 #define CTX_H
 4561 #define CTX_hanging        CTX_STRH('h','a','n','g','i','n','g',0,0,0,0,0,0,
 4562                                     0)
 4563 #define CTX_height         CTX_STRH('h','e','i','g','h','t',0,0,0,0,0,0,0,0)
 4564 #define CTX_hor_line_to    CTX_STRH('h','o','r','_','l','i','n','e','_','t',
 4565                                     'o',0,0,0)
 4566 #define CTX_horLineTo      CTX_STRH('h','o','r','L','i','n','e','T','o',0,0,
 4567                                     0,0,0)
 4568 #define CTX_hue            CTX_STRH('h','u','e',0,0,0,0,0,0,0,0,0,0,0)
 4569 #define CTX_identity       CTX_STRH('i','d','e','n','t','i','t','y',0,0,0,0,
 4570                                     0,0)
 4571 #define CTX_ideographic    CTX_STRH('i','d','e','o','g','r','a','p','h','i',
 4572                                     'c',0,0,0)
 4573 #define CTX_join           CTX_STRH('j','o','i','n',0,0,0,0,0,0,0,0,0,0)
 4574 #define CTX_laba           CTX_STRH('l','a','b','a',0,0,0,0,0,0,0,0,0,0)
 4575 #define CTX_lab            CTX_STRH('l','a','b',0,0,0,0,0,0,0,0,0,0,0)
 4576 #define CTX_lcha           CTX_STRH('l','c','h','a',0,0,0,0,0,0,0,0,0,0)
 4577 #define CTX_lch            CTX_STRH('l','c','h',0,0,0,0,0,0,0,0,0,0,0)
 4578 #define CTX_left           CTX_STRH('l','e','f','t',0,0, 0, 0, 0, 0, 0, 0,0,
 4579                                     0)
 4580 #define CTX_lighter        CTX_STRH('l','i','g','h','t','e','r',0,0,0,0,0,0,
 4581                                     0)
 4582 #define CTX_lighten        CTX_STRH('l','i','g','h','t','e','n',0,0,0,0,0,0,
 4583                                     0)
 4584 #define CTX_linear_gradient CTX_STRH('l','i','n','e','a','r','_','g','r',
 4585                                      'a','d','i','e','n')
 4586 #define CTX_linearGradient CTX_STRH('l','i','n','e','a','r','G','r','a','d',
 4587                                     'i','e','n','t')
 4588 #define CTX_line_cap       CTX_STRH('l','i','n','e','_','c','a','p',0,0,0,0,
 4589                                     0,0)
 4590 #define CTX_lineCap        CTX_STRH('l','i','n','e','C','a','p',0,0,0,0,0,0,
 4591                                     0)
 4592 #define CTX_setLineCap     CTX_STRH('s','e','t','L','i','n','e','C','a','p',
 4593                                     0,0,0,0)
 4594 #define CTX_line_height    CTX_STRH('l','i','n','e','_','h','e','i','h','t',
 4595                                     0,0,0,0)
 4596 #define CTX_line_join      CTX_STRH('l','i','n','e','_','j','o','i','n',0,0,
 4597                                     0,0,0)
 4598 #define CTX_lineJoin       CTX_STRH('l','i','n','e','J','o','i','n',0,0,0,0,
 4599                                     0,0)
 4600 #define CTX_setLineJoin    CTX_STRH('s','e','t','L','i','n','e','J','o','i',
 4601                                     'n',0,0,0)
 4602 #define CTX_line_spacing   CTX_STRH('l','i','n','e','_','s','p','a','c','i',
 4603                                     'n','g',0,0)
 4604 #define CTX_line_to        CTX_STRH('l','i','n','e','_','t','o',0,0,0,0,0,0,
 4605                                     0)
 4606 #define CTX_lineTo         CTX_STRH('l','i','n','e','T','o',0,0,0,0,0,0,0,0)
 4607 #define CTX_lineDash       CTX_STRH('l','i','n','e','D','a','s','h',0,0,0,0,
 4608                                     0,0)
 4609 #define CTX_line_width     CTX_STRH('l','i','n','e','_','w','i','d','t','h',
 4610                                     0,0,0,0)
 4611 #define CTX_lineWidth      CTX_STRH('l','i','n','e','W','i','d','t','h',0,0,
 4612                                     0,0,0)
 4613 #define CTX_setLineWidth   CTX_STRH('s','e','t','L','i','n','e','W','i','d',
 4614                                     't','h',0,0)
 4615 #define CTX_view_box       CTX_STRH('v','i','e','w','_','b','o','x',0,0,0,0,
 4616                                     0,0)
 4617 #define CTX_viewBox        CTX_STRH('v','i','e','w','B','o','x',0,0,0,0,0,0,
 4618                                     0)
 4619 #define CTX_middle         CTX_STRH('m','i','d','d','l','e',0, 0, 0, 0, 0, 
 4620                                     0,0,0)
 4621 #define CTX_miter          CTX_STRH('m','i','t','e','r',0, 0, 0, 0, 0, 0, 0,
 4622                                     0,0)
 4623 #define CTX_miter_limit    CTX_STRH('m','i','t','e','r','_','l','i','m','i',
 4624                                     't',0,0,0)
 4625 #define CTX_miterLimit     CTX_STRH('m','i','t','e','r','L','i','m','i','t',
 4626                                     0,0,0,0)
 4627 #define CTX_move_to        CTX_STRH('m','o','v','e','_','t','o',0,0,0,0,0,0,
 4628                                     0)
 4629 #define CTX_moveTo         CTX_STRH('m','o','v','e','T','o',0,0,0,0,0,0,0,0)
 4630 #define CTX_multiply       CTX_STRH('m','u','l','t','i','p','l','y',0,0,0,0,
 4631                                     0,0)
 4632 #define CTX_new_page       CTX_STRH('n','e','w','_','p','a','g','e',0,0,0,0,
 4633                                     0,0)
 4634 #define CTX_newPage        CTX_STRH('n','e','w','P','a','g','e',0,0,0,0,0,0,
 4635                                     0)
 4636 #define CTX_new_path       CTX_STRH('n','e','w','_','p','a','t','h',0,0,0,0,
 4637                                     0,0)
 4638 #define CTX_newPath        CTX_STRH('n','e','w','P','a','t','h',0,0,0,0,0,0,
 4639                                     0)
 4640 #define CTX_new_state      CTX_STRH('n','e','w','_','s','t','a','t','e',0,0,
 4641                                     0,0,0)
 4642 #define CTX_none           CTX_STRH('n','o','n','e', 0 ,0, 0, 0, 0, 0, 0, 0,
 4643                                     0,0)
 4644 #define CTX_normal         CTX_STRH('n','o','r','m','a','l',0,0,0,0,0,0,0,0)
 4645 #define CTX_quad_to        CTX_STRH('q','u','a','d','_','t','o',0,0,0,0,0,0,
 4646                                     0)
 4647 #define CTX_quadTo         CTX_STRH('q','u','a','d','T','o',0,0,0,0,0,0,0,0)
 4648 #define CTX_radial_gradient CTX_STRH('r','a','d','i','a','l','_','g','r',
 4649                                      'a','d','i','e','n')
 4650 #define CTX_radialGradient  CTX_STRH('r','a','d','i','a','l','G','r','a',
 4651                                      'd','i','e','n','t')
 4652 #define CTX_rectangle      CTX_STRH('r','e','c','t','a','n','g','l','e',0,0,
 4653                                     0,0,0)
 4654 #define CTX_rect           CTX_STRH('r','e','c','t',0,0,0,0,0,0,0,0,0,0)
 4655 #define CTX_rel_arc_to     CTX_STRH('r','e','l','_','a','r','c','_','t','o',
 4656                                     0,0,0,0)
 4657 #define CTX_relArcTo       CTX_STRH('r','e','l','A','r','c','T','o',0,0,0,0,
 4658                                     0,0)
 4659 #define CTX_rel_curve_to   CTX_STRH('r','e','l','_','c','u','r','v','e','_',
 4660                                     't','o',0,0)
 4661 #define CTX_relCurveTo     CTX_STRH('r','e','l','C','u','r','v','e','T','o',
 4662                                     0,0,0,0)
 4663 #define CTX_rel_hor_line_to CTX_STRH('r','e','l','_','h','o','r','_','l',
 4664                                      'i','n','e',0,0)
 4665 #define CTX_relHorLineTo   CTX_STRH('r','e','l','H','o','r','L','i','n','e',
 4666                                     'T','o',0,0)
 4667 #define CTX_rel_line_to    CTX_STRH('r','e','l','_','l','i','n','e','_','t',
 4668                                     'o',0,0,0)
 4669 #define CTX_relLineTo      CTX_STRH('r','e','l','L','i','n','e','T','o',0,0,
 4670                                     0,0,0)
 4671 #define CTX_rel_move_to    CTX_STRH('r','e','l','_','m','o','v','e','_','t',
 4672                                     'o',0,0,0)
 4673 #define CTX_relMoveTo      CTX_STRH('r','e','l','M','o','v','e','T','o',0,0,
 4674                                     0,0,0)
 4675 #define CTX_rel_quad_to    CTX_STRH('r','e','l','_','q','u','a','d','_','t',
 4676                                     'o',0,0,0)
 4677 #define CTX_relQuadTo      CTX_STRH('r','e','l','Q','u','a','d','T','o',0,0,
 4678                                     0,0,0)
 4679 #define CTX_rel_smoothq_to CTX_STRH('r','e','l','_','s','m','o','o','t','h',
 4680                                     'q','_','t','o')
 4681 #define CTX_relSmoothqTo   CTX_STRH('r','e','l','S','m','o','o','t','h','q',
 4682                                     'T','o',0,0)
 4683 #define CTX_rel_smooth_to  CTX_STRH('r','e','l','_','s','m','o','o','t','h',
 4684                                     '_','t','o',0)
 4685 #define CTX_relSmoothTo    CTX_STRH('r','e','l','S','m','o','o','t','h','T',
 4686                                     'o',0,0,0)
 4687 #define CTX_rel_ver_line_to CTX_STRH('r','e','l','_','v','e','r','_','l',
 4688                                      'i','n','e',0,0)
 4689 #define CTX_relVerLineTo   CTX_STRH('r','e','l','V','e','r','L','i','n','e',
 4690                                     'T','o',0,0)
 4691 #define CTX_restore        CTX_STRH('r','e','s','t','o','r','e',0,0,0,0,0,0,
 4692                                     0)
 4693 #define CTX_reset          CTX_STRH('r','e','s','e','t',0,0,0,0,0,0,0,0,0)
 4694 #define CTX_rgba           CTX_STRH('r','g','b','a',0,0,0,0,0,0,0,0,0,0)
 4695 #define CTX_rgb            CTX_STRH('r','g','b',0,0,0,0,0,0,0,0,0,0,0)
 4696 #define CTX_right          CTX_STRH('r','i','g','h','t',0, 0, 0, 0, 0, 0, 0,
 4697                                     0,0)
 4698 #define CTX_rotate         CTX_STRH('r','o','t','a','t','e',0,0,0,0,0,0,0,0)
 4699 #define CTX_round          CTX_STRH('r','o','u','n','d',0, 0, 0, 0, 0, 0, 0,
 4700                                     0,0)
 4701 #define CTX_round_rectangle CTX_STRH('r','o','u','n','d','_','r','e','c',
 4702                                      't','a','n','g','l')
 4703 #define CTX_roundRectangle  CTX_STRH('r','o','u','n','d','R','e','c','t',
 4704                                      'a','n','g','l','e')
 4705 #define CTX_save           CTX_STRH('s','a','v','e',0,0,0,0,0,0,0,0,0,0)
 4706 #define CTX_save           CTX_STRH('s','a','v','e',0,0,0,0,0,0,0,0,0,0)
 4707 #define CTX_scale          CTX_STRH('s','c','a','l','e',0,0,0,0,0,0,0,0,0)
 4708 #define CTX_screen         CTX_STRH('s','c','r','e','e','n',0,0,0,0,0,0,0,0)
 4709 #define CTX_setkey         CTX_STRH('s','e','t','k','e','y',0,0,0,0,0,0,0,0)
 4710 #define CTX_shadowBlur     CTX_STRH('s','h','a','d','o','w','B','l','u','r',
 4711                                     0,0,0,0)
 4712 #define CTX_shadowColor    CTX_STRH('s','h','a','d','o','w','C','o','l','o',
 4713                                     'r',0,0,0)
 4714 #define CTX_shadowOffsetX  CTX_STRH('s','h','a','d','o','w','O','f','f','s',
 4715                                     'e','t','X',0)
 4716 #define CTX_shadowOffsetY  CTX_STRH('s','h','a','d','o','w','O','f','f','s',
 4717                                     'e','t','Y',0)
 4718 #define CTX_smooth_quad_to CTX_STRH('s','m','o','o','t','h','_','q','u','a',
 4719                                     'd','_','t','o')
 4720 #define CTX_smoothQuadTo   CTX_STRH('s','m','o','o','t','h','Q','u','a','d',
 4721                                     'T','o',0,0)
 4722 #define CTX_smooth_to      CTX_STRH('s','m','o','o','t','h','_','t','o',0,0,
 4723                                     0,0,0)
 4724 #define CTX_smoothTo       CTX_STRH('s','m','o','o','t','h','T','o',0,0,0,0,
 4725                                     0,0)
 4726 #define CTX_sourceIn       CTX_STRH('s','o','u','r','c','e','I','n',0,0,0,0,
 4727                                     0,0)
 4728 #define CTX_source_in      CTX_STRH('s','o','u','r','c','e','_','i','n',0,0,
 4729                                     0,0,0)
 4730 #define CTX_sourceAtop     CTX_STRH('s','o','u','r','c','e','A','t','o','p',
 4731                                     0,0,0,0)
 4732 #define CTX_source_atop    CTX_STRH('s','o','u','r','c','e','_','a','t','o',
 4733                                     'p',0,0,0)
 4734 #define CTX_sourceOut      CTX_STRH('s','o','u','r','c','e','O','u','t',0,0,
 4735                                     0,0,0)
 4736 #define CTX_source_out     CTX_STRH('s','o','u','r','c','e','_','o','u','t',
 4737                                     0,0,0,0)
 4738 #define CTX_sourceOver     CTX_STRH('s','o','u','r','c','e','O','v','e','r',
 4739                                     0,0,0,0)
 4740 #define CTX_source_over    CTX_STRH('s','o','u','r','c','e','_','o','v','e',
 4741                                     'r',0,0,0)
 4742 #define CTX_square         CTX_STRH('s','q','u','a','r','e', 0, 0, 0, 0, 0, 
 4743                                     0,0,0)
 4744 #define CTX_start          CTX_STRH('s','t','a','r','t',0, 0, 0, 0, 0, 0, 0,
 4745                                     0,0)
 4746 #define CTX_start_move     CTX_STRH('s','t','a','r','t','_','m','o','v','e',
 4747                                     0,0,0,0)
 4748 #define CTX_start_group    CTX_STRH('s','t','a','r','t','_','G','r','o','u',
 4749                                     'p',0,0,0)
 4750 #define CTX_startGroup     CTX_STRH('s','t','a','r','t','G','r','o','u','p',
 4751                                     0,0,0,0)
 4752 #define CTX_stroke         CTX_STRH('s','t','r','o','k','e',0,0,0,0,0,0,0,0)
 4753 #define CTX_text_align     CTX_STRH('t','e','x','t','_','a','l','i','g','n',
 4754                                     0, 0,0,0)
 4755 #define CTX_textAlign      CTX_STRH('t','e','x','t','A','l','i','g','n',0, 
 4756                                     0, 0,0,0)
 4757 #define CTX_texture        CTX_STRH('t','e','x','t','u','r','e',0,0,0, 0, 0,
 4758                                     0,0)
 4759 #define CTX_text_baseline  CTX_STRH('t','e','x','t','_','b','a','s','e','l',
 4760                                     'i','n','e',0)
 4761 #define CTX_text_baseline  CTX_STRH('t','e','x','t','_','b','a','s','e','l',
 4762                                     'i','n','e',0)
 4763 #define CTX_textBaseline   CTX_STRH('t','e','x','t','B','a','s','e','l','i',
 4764                                     'n','e',0,0)
 4765 #define CTX_text           CTX_STRH('t','e','x','t',0,0,0,0,0,0,0,0,0,0)
 4766 #define CTX_text_direction CTX_STRH('t','e','x','t','_','d','i','r','e','c',
 4767                                     't','i','o','n')
 4768 #define CTX_textDirection  CTX_STRH('t','e','x','t','D','i','r','e','c','t',
 4769                                     'i','o','n',0)
 4770 #define CTX_text_indent    CTX_STRH('t','e','x','t','_','i','n','d','e','n',
 4771                                     't', 0,0,0)
 4772 #define CTX_text_stroke    CTX_STRH('t','e','x','t','_','s','t','r','o','k',
 4773                                     'e', 0,0,0)
 4774 #define CTX_textStroke     CTX_STRH('t','e','x','t','S','t','r','o','k','e',
 4775                                     0, 0,0,0)
 4776 #define CTX_top            CTX_STRH('t','o','p',0,0,0, 0, 0, 0, 0, 0, 0,0,0)
 4777 #define CTX_transform      CTX_STRH('t','r','a','n','s','f','o','r','m',0,0,
 4778                                     0,0,0)
 4779 #define CTX_translate      CTX_STRH('t','r','a','n','s','l','a','t','e',0,0,
 4780                                     0,0,0)
 4781 #define CTX_verLineTo      CTX_STRH('v','e','r','L','i','n','e','T','o',0,0,
 4782                                     0,0,0)
 4783 #define CTX_ver_line_to    CTX_STRH('v','e','r','_','l','i','n','e','_','t',
 4784                                     'o',0,0,0)
 4785 #define CTX_width          CTX_STRH('w','i','d','t','h',0,0,0,0,0,0,0,0,0)
 4786 #define CTX_winding        CTX_STRH('w','i','n','d','i','n', 'g', 0, 0, 0, 
 4787                                     0, 0,0,0)
 4788 #define CTX_x              CTX_STRH('x',0,0,0,0,0,0,0,0,0,0,0,0,0)
 4789 #define CTX_xor            CTX_STRH('x','o','r',0,0,0,0,0,0,0,0,0,0,0)
 4790 #define CTX_y              CTX_STRH('y',0,0,0,0,0,0,0,0,0,0,0,0,0)
 4791 
 4792 
 4793 #define CTX_colorSpace     CTX_STRH('c','o','l','o','r','S','p','a','c','e',
 4794                                     0,0,0,0)
 4795 #define CTX_userRGB        CTX_STRH('u','s','e','r','R','G','B',0,0,0,0,0,0,
 4796                                     0)
 4797 #define CTX_userCMYK       CTX_STRH('u','s','e','r','C','M','Y','K',0,0,0,0,
 4798                                     0,0)
 4799 #define CTX_deviceRGB      CTX_STRH('d','e','v','i','c','e','r','R','G','B',
 4800                                     0,0,0,0)
 4801 #define CTX_deviceCMYK     CTX_STRH('d','e','v','i','c','e','r','C','M','Y',
 4802                                     'K',0,0,0)
 4803 
 4804 #endif
 4805 #ifndef __CTX_LIBC_H
 4806 #define __CTX_LIBC_H
 4807 
 4808 #include <stddef.h>
 4809 
 4810 #if 0
 4811 static inline void
 4812 ctx_memset (void *ptr, uint8_t val, int length)
 4813 {
 4814   uint8_t *p = (uint8_t *) ptr;
 4815   for (int i = 0; i < length; i ++)
 4816     { p[i] = val; }
 4817 }
 4818 #else
 4819 #define ctx_memset memset
 4820 #endif
 4821 
 4822 
 4823 static inline void ctx_strcpy (char *dst, const char *src)
 4824 {
 4825   int i = 0;
 4826   for (i = 0; src[i]; i++)
 4827     { dst[i] = src[i]; }
 4828   dst[i] = 0;
 4829 }
 4830 
 4831 static inline char *_ctx_strchr (const char *haystack, char needle)
 4832 {
 4833   const char *p = haystack;
 4834   while (*p && *p != needle)
 4835     {
 4836       p++;
 4837     }
 4838   if (*p == needle)
 4839     { return (char *) p; }
 4840   return NULL;
 4841 }
 4842 static inline char *ctx_strchr (const char *haystack, char needle)
 4843 {
 4844   return _ctx_strchr (haystack, needle);
 4845 }
 4846 
 4847 static inline int ctx_strcmp (const char *a, const char *b)
 4848 {
 4849   int i;
 4850   for (i = 0; a[i] && b[i]; a++, b++)
 4851     if (a[0] != b[0])
 4852       { return 1; }
 4853   if (a[0] == 0 && b[0] == 0) { return 0; }
 4854   return 1;
 4855 }
 4856 
 4857 static inline int ctx_strncmp (const char *a, const char *b, size_t n)
 4858 {
 4859   size_t i;
 4860   for (i = 0; a[i] && b[i] && i < n; a++, b++)
 4861     if (a[0] != b[0])
 4862       { return 1; }
 4863   return 0;
 4864 }
 4865 
 4866 static inline int ctx_strlen (const char *s)
 4867 {
 4868   int len = 0;
 4869   for (; *s; s++) { len++; }
 4870   return len;
 4871 }
 4872 
 4873 static inline char *ctx_strstr (const char *h, const char *n)
 4874 {
 4875   int needle_len = ctx_strlen (n);
 4876   if (n[0]==0)
 4877     { return (char *) h; }
 4878   while (h)
 4879     {
 4880       h = ctx_strchr (h, n[0]);
 4881       if (!h)
 4882         { return NULL; }
 4883       if (!ctx_strncmp (h, n, needle_len) )
 4884         { return (char *) h; }
 4885       h++;
 4886     }
 4887   return NULL;
 4888 }
 4889 
 4890 #endif
 4891 
 4892 #if CTX_IMPLEMENTATION|CTX_COMPOSITE
 4893 
 4894 #ifndef __CTX_INTERNAL_H
 4895 #define __CTX_INTERNAL_H
 4896 
 4897 #include <stdlib.h>
 4898 #include <stdio.h>
 4899 #include <unistd.h>
 4900 #include <math.h>
 4901 #include <sys/select.h> 
 4902 
 4903 typedef struct _CtxRasterizer CtxRasterizer;
 4904 typedef struct _CtxGState     CtxGState;
 4905 typedef struct _CtxState      CtxState;
 4906 
 4907 typedef struct _CtxSource CtxSource;
 4908 
 4909 
 4910 #define CTX_VALID_RGBA_U8     (1<<0)
 4911 #define CTX_VALID_RGBA_DEVICE (1<<1)
 4912 #if CTX_ENABLE_CM
 4913 #define CTX_VALID_RGBA        (1<<2)
 4914 #endif
 4915 #if CTX_ENABLE_CMYK
 4916 #define CTX_VALID_CMYKA       (1<<3)
 4917 #define CTX_VALID_DCMYKA      (1<<4)
 4918 #endif
 4919 #define CTX_VALID_GRAYA       (1<<5)
 4920 #define CTX_VALID_GRAYA_U8    (1<<6)
 4921 #define CTX_VALID_LABA        ((1<<7) | CTX_VALID_GRAYA)
 4922 
 4923 //_ctx_target_space (ctx, icc);
 4924 //_ctx_space (ctx);
 4925 
 4926 struct _CtxColor
 4927 {
 4928   uint8_t magic; // for colors used in keydb, set to a non valid start of
 4929                  // string value.
 4930   uint8_t rgba[4];
 4931   uint8_t l_u8;
 4932   uint8_t original; // the bitmask of the originally set color
 4933   uint8_t valid;    // bitmask of which members contain valid
 4934   // values, gets denser populated as more
 4935   // formats are requested from a set color.
 4936   float   device_red;
 4937   float   device_green;
 4938   float   device_blue;
 4939   float   alpha;
 4940   float   l;        // luminance and gray
 4941 #if CTX_ENABLE_LAB  // NYI
 4942   float   a;
 4943   float   b;
 4944 #endif
 4945 #if CTX_ENABLE_CMYK
 4946   float   device_cyan;
 4947   float   device_magenta;
 4948   float   device_yellow;
 4949   float   device_key;
 4950   float   cyan;
 4951   float   magenta;
 4952   float   yellow;
 4953   float   key;
 4954 #endif
 4955 
 4956 #if CTX_ENABLE_CM
 4957 #if CTX_BABL
 4958   const Babl *space; // gets copied from state when color is declared
 4959 #else
 4960   void   *space; // gets copied from state when color is declared, 
 4961 #endif
 4962   float   red;
 4963   float   green;
 4964   float   blue;
 4965 #endif
 4966 };
 4967 
 4968 typedef struct _CtxGradientStop CtxGradientStop;
 4969 
 4970 struct _CtxGradientStop
 4971 {
 4972   float   pos;
 4973   CtxColor color;
 4974 };
 4975 
 4976 
 4977 enum _CtxSourceType
 4978 {
 4979   CTX_SOURCE_COLOR = 0,
 4980   CTX_SOURCE_IMAGE,
 4981   CTX_SOURCE_LINEAR_GRADIENT,
 4982   CTX_SOURCE_RADIAL_GRADIENT,
 4983 };
 4984 
 4985 typedef enum _CtxSourceType CtxSourceType;
 4986 
 4987 typedef struct _CtxPixelFormatInfo CtxPixelFormatInfo;
 4988 
 4989 
 4990 struct _CtxBuffer
 4991 {
 4992   void               *data;
 4993   int                 width;
 4994   int                 height;
 4995   int                 stride;
 4996   int                 revision; // XXX NYI, number to update when contents 
 4997   change
 4998                                 //
 4999   CtxPixelFormatInfo *format;
 5000   void (*free_func) (void *pixels, void *user_data);
 5001   void               *user_data;
 5002 };
 5003 
 5004 //void _ctx_user_to_device          (CtxState *state, float *x, float *y);
 5005 //void _ctx_user_to_device_distance (CtxState *state, float *x, float *y);
 5006 
 5007 typedef struct _CtxGradient CtxGradient;
 5008 struct _CtxGradient
 5009 {
 5010   CtxGradientStop stops[16];
 5011   int n_stops;
 5012 };
 5013 
 5014 struct _CtxSource
 5015 {
 5016   int type;
 5017   CtxMatrix  transform;
 5018   union
 5019   {
 5020     CtxColor color;
 5021     struct
 5022     {
 5023       uint8_t rgba[4]; // shares data with set color
 5024       uint8_t pad;
 5025       float x0;
 5026       float y0;
 5027       CtxBuffer *buffer;
 5028     } image;
 5029     struct
 5030     {
 5031       float x0;
 5032       float y0;
 5033       float x1;
 5034       float y1;
 5035       float dx;
 5036       float dy;
 5037       float start;
 5038       float end;
 5039       float length;
 5040       float rdelta;
 5041     } linear_gradient;
 5042     struct
 5043     {
 5044       float x0;
 5045       float y0;
 5046       float r0;
 5047       float x1;
 5048       float y1;
 5049       float r1;
 5050       float rdelta;
 5051     } radial_gradient;
 5052   };
 5053 };
 5054 
 5055 struct _CtxGState
 5056 {
 5057   int           keydb_pos;
 5058   int           stringpool_pos;
 5059 
 5060   CtxMatrix     transform;
 5061   //CtxSource   source_stroke;
 5062   CtxSource     source;
 5063   float         global_alpha_f;
 5064   uint8_t       global_alpha_u8;
 5065 
 5066   float         line_width;
 5067   float         miter_limit;
 5068   float         font_size;
 5069 #if CTX_ENABLE_SHADOW_BLUR
 5070   float         shadow_blur;
 5071   float         shadow_offset_x;
 5072   float         shadow_offset_y;
 5073 #endif
 5074   int           clipped:1;
 5075 
 5076   int16_t       clip_min_x;
 5077   int16_t       clip_min_y;
 5078   int16_t       clip_max_x;
 5079   int16_t       clip_max_y;
 5080 
 5081 #if CTX_ENABLE_CM
 5082 #if CTX_BABL
 5083   const Babl   *device_space;
 5084   const Babl   *rgb_space;       
 5085   const Babl   *cmyk_space;
 5086 
 5087   const Babl   *fish_rgbaf_user_to_device;
 5088   const Babl   *fish_rgbaf_device_to_user;
 5089 #else
 5090   void         *device_space;
 5091   void         *rgb_space;       
 5092   void         *cmyk_space;
 5093   void         *fish_rgbaf_user_to_device; // dummy padding
 5094   void         *fish_rgbaf_device_to_user; // dummy padding
 5095 #endif
 5096 #endif
 5097   CtxCompositingMode  compositing_mode; // bitfield refs lead to
 5098   CtxBlend                  blend_mode; // non-vectorization
 5099 
 5100   float dashes[CTX_PARSER_MAX_ARGS];
 5101   int n_dashes;
 5102 
 5103   CtxColorModel color_model;
 5104   /* bitfield-pack small state-parts */
 5105   CtxLineCap                  line_cap:2;
 5106   CtxLineJoin                line_join:2;
 5107   CtxFillRule                fill_rule:1;
 5108   unsigned int                    font:6;
 5109   unsigned int                    bold:1;
 5110   unsigned int                  italic:1;
 5111 };
 5112 
 5113 typedef enum
 5114 {
 5115   CTX_TRANSFORMATION_NONE         = 0,
 5116   CTX_TRANSFORMATION_SCREEN_SPACE = 1,
 5117   CTX_TRANSFORMATION_RELATIVE     = 2,
 5118 #if CTX_BITPACK
 5119   CTX_TRANSFORMATION_BITPACK      = 4,
 5120 #endif
 5121   CTX_TRANSFORMATION_STORE_CLEAR  = 16,
 5122 } CtxTransformation;
 5123 
 5124 #define CTX_DRAWLIST_DOESNT_OWN_ENTRIES   64
 5125 #define CTX_DRAWLIST_EDGE_LIST            128
 5126 #define CTX_DRAWLIST_CURRENT_PATH         512
 5127 // BITPACK
 5128 
 5129 struct _CtxDrawlist
 5130 {
 5131   CtxEntry *entries;
 5132   int       count;
 5133   int       size;
 5134   uint32_t  flags;
 5135   int       bitpack_pos;  // stream is bitpacked up to this offset
 5136 };
 5137 
 5138 
 5139 
 5140 #define CTX_MAX_KEYDB 64 // number of entries in keydb
 5141                          // entries are "copy-on-change" between states
 5142 
 5143 // the keydb consists of keys set to floating point values,
 5144 // that might also be interpreted as integers for enums.
 5145 //
 5146 // the hash
 5147 typedef struct _CtxKeyDbEntry CtxKeyDbEntry;
 5148 struct _CtxKeyDbEntry
 5149 {
 5150   uint32_t key;
 5151   float value;
 5152   //union { float f[1]; uint8_t u8[4]; }value;
 5153 };
 5154 
 5155 struct _CtxState
 5156 {
 5157   int           has_moved:1;
 5158   int           has_clipped:1;
 5159   float         x;
 5160   float         y;
 5161   int           min_x;
 5162   int           min_y;
 5163   int           max_x;
 5164   int           max_y;
 5165   int16_t       gstate_no;
 5166   CtxGState     gstate;
 5167   CtxGState     gstate_stack[CTX_MAX_STATES];//at end, so can be made 
 5168   dynamic
 5169 #if CTX_GRADIENTS
 5170   CtxGradient   gradient; /* we keep only one gradient,
 5171                              this goes icky with multiple
 5172                              restores - it should really be part of
 5173                              graphics state..
 5174                              XXX, with the stringpool gradients
 5175                              can be stored there.
 5176                            */
 5177 #endif
 5178   CtxKeyDbEntry keydb[CTX_MAX_KEYDB];
 5179   char          stringpool[CTX_STRINGPOOL_SIZE];
 5180 };
 5181 
 5182 
 5183 typedef struct _CtxFont       CtxFont;
 5184 typedef struct _CtxFontEngine CtxFontEngine;
 5185 
 5186 struct _CtxFontEngine
 5187 {
 5188 #if CTX_FONTS_FROM_FILE
 5189   int   (*load_file)   (const char *name, const char *path);
 5190 #endif
 5191   int   (*load_memory) (const char *name, const void *data, int length);
 5192   int   (*glyph)       (CtxFont *font, Ctx *ctx, uint32_t unichar, int 
 5193          stroke);
 5194   float (*glyph_width) (CtxFont *font, Ctx *ctx, uint32_t unichar);
 5195   float (*glyph_kern)  (CtxFont *font, Ctx *ctx, uint32_t unicharA, 
 5196          uint32_t unicharB);
 5197 };
 5198 
 5199 struct _CtxFont
 5200 {
 5201   CtxFontEngine *engine;
 5202   const char *name;
 5203   int type; // 0 ctx    1 stb    2 monobitmap
 5204   union
 5205   {
 5206     struct
 5207     {
 5208       CtxEntry *data;
 5209       int length;
 5210       /* we've got ~110 bytes to fill to cover as
 5211          much data as stbtt_fontinfo */
 5212       //int16_t glyph_pos[26]; // for a..z
 5213       int       glyphs; // number of glyphs
 5214       uint32_t *index;
 5215     } ctx;
 5216     struct
 5217     {
 5218       char *path;
 5219     } ctx_fs;
 5220 #if CTX_FONT_ENGINE_STB
 5221     struct
 5222     {
 5223       stbtt_fontinfo ttf_info;
 5224       int cache_index;
 5225       uint32_t cache_unichar;
 5226     } stb;
 5227 #endif
 5228     struct { int start; int end; int gw; int gh; const uint8_t *data;} 
 5229              monobitmap;
 5230   };
 5231 };
 5232 
 5233 
 5234 enum _CtxIteratorFlag
 5235 {
 5236   CTX_ITERATOR_FLAT           = 0,
 5237   CTX_ITERATOR_EXPAND_BITPACK = 2,
 5238   CTX_ITERATOR_DEFAULTS       = CTX_ITERATOR_EXPAND_BITPACK
 5239 };
 5240 typedef enum _CtxIteratorFlag CtxIteratorFlag;
 5241 
 5242 
 5243 struct
 5244   _CtxIterator
 5245 {
 5246   int              pos;
 5247   int              first_run;
 5248   CtxDrawlist *drawlist;
 5249   int              end_pos;
 5250   int              flags;
 5251 
 5252   int              bitpack_pos;
 5253   int              bitpack_length;     // if non 0 bitpack is active
 5254   CtxEntry         bitpack_command[6]; // the command returned to the
 5255   // user if unpacking is needed.
 5256 };
 5257 #define CTX_MAX_DEVICES 16
 5258 #define CTX_MAX_KEYBINDINGS         256
 5259 
 5260 #if CTX_EVENTS 
 5261 
 5262 // include list implementation - since it already is a header+inline online
 5263 // implementation?
 5264 
 5265 typedef struct CtxItemCb {
 5266   CtxEventType types;
 5267   CtxCb        cb;
 5268   void*        data1;
 5269   void*        data2;
 5270 
 5271   void (*finalize) (void *data1, void *data2, void *finalize_data);
 5272   void  *finalize_data;
 5273 
 5274 } CtxItemCb;
 5275 
 5276 
 5277 #define CTX_MAX_CBS              128
 5278 
 5279 typedef struct CtxItem {
 5280   CtxMatrix inv_matrix;  /* for event coordinate transforms */
 5281 
 5282   /* bounding box */
 5283   float          x0;
 5284   float          y0;
 5285   float          x1;
 5286   float          y1;
 5287 
 5288   void *path;
 5289   double          path_hash;
 5290 
 5291   CtxCursor       cursor; /* if 0 then UNSET and no cursor change is 
 5292   requested
 5293                            */
 5294 
 5295   CtxEventType   types;   /* all cb's ored together */
 5296   CtxItemCb cb[CTX_MAX_CBS];
 5297   int       cb_count;
 5298   int       ref_count;
 5299 } CtxItem;
 5300 
 5301 
 5302 typedef struct _CtxEvents CtxEvents;
 5303