| 1 | /* $Id$ $Revision$ */ |
| 2 | /* vim:set shiftwidth=4 ts=8: */ |
| 3 | |
| 4 | /************************************************************************* |
| 5 | * Copyright (c) 2011 AT&T Intellectual Property |
| 6 | * All rights reserved. This program and the accompanying materials |
| 7 | * are made available under the terms of the Eclipse Public License v1.0 |
| 8 | * which accompanies this distribution, and is available at |
| 9 | * http://www.eclipse.org/legal/epl-v10.html |
| 10 | * |
| 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ |
| 12 | *************************************************************************/ |
| 13 | |
| 14 | #ifndef TEXTSPAN_H |
| 15 | #define TEXTSPAN_H |
| 16 | |
| 17 | #ifdef __cplusplus |
| 18 | extern "C" { |
| 19 | #endif |
| 20 | |
| 21 | /* Bold, Italic, Underline, Sup, Sub, Strike */ |
| 22 | /* Stored in textfont_t.flags, which is 7 bits, so full */ |
| 23 | /* Probably should be moved to textspan_t */ |
| 24 | #define HTML_BF (1 << 0) |
| 25 | #define HTML_IF (1 << 1) |
| 26 | #define HTML_UL (1 << 2) |
| 27 | #define HTML_SUP (1 << 3) |
| 28 | #define HTML_SUB (1 << 4) |
| 29 | #define HTML_S (1 << 5) |
| 30 | #define HTML_OL (1 << 6) |
| 31 | |
| 32 | typedef struct _PostscriptAlias { |
| 33 | char* name; |
| 34 | char* family; |
| 35 | char* weight; |
| 36 | char* stretch; |
| 37 | char* style; |
| 38 | int xfig_code; |
| 39 | char* svg_font_family; |
| 40 | char* svg_font_weight; |
| 41 | char* svg_font_style; |
| 42 | } PostscriptAlias; |
| 43 | |
| 44 | /* font information |
| 45 | * If name or color is NULL, or size < 0, that attribute |
| 46 | * is unspecified. |
| 47 | */ |
| 48 | typedef struct { |
| 49 | char* name; |
| 50 | char* color; |
| 51 | PostscriptAlias *postscript_alias; |
| 52 | double size; |
| 53 | unsigned int flags:7; /* HTML_UL, HTML_IF, HTML_BF, etc. */ |
| 54 | unsigned int cnt:(sizeof(unsigned int) * 8 - 7); /* reference count */ |
| 55 | } textfont_t; |
| 56 | |
| 57 | /* atomic unit of text emitted using a single htmlfont_t */ |
| 58 | typedef struct { |
| 59 | char *str; /* stored in utf-8 */ |
| 60 | textfont_t *font; |
| 61 | void *layout; |
| 62 | void (*free_layout) (void *layout); /* FIXME - this is ugly */ |
| 63 | double yoffset_layout, yoffset_centerline; |
| 64 | pointf size; |
| 65 | char just; /* 'l' 'n' 'r' */ /* FIXME */ |
| 66 | } textspan_t; |
| 67 | |
| 68 | #ifdef __cplusplus |
| 69 | } |
| 70 | #endif |
| 71 | #endif |
| 72 | |