Debian Codegraph @

lib/common/textspan.h

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