comparison src/shape_stext.c @ 407:92a459a1c5aa

more comment
author Thinker K.F. Li <thinker@branda.to>
date Tue, 07 Jul 2009 22:45:12 +0800
parents aee0f66b1154
children 1a923ea699c1
comparison
equal deleted inserted replaced
404:e774868fb7df 407:92a459a1c5aa
10 #define ASSERT(x) 10 #define ASSERT(x)
11 #endif 11 #endif
12 #define OK 0 12 #define OK 0
13 #define ERR -1 13 #define ERR -1
14 14
15 /*! \page stext Simple Text
16 *
17 * A sh_stext_t is broken into fragments. Each fragment comprises the text
18 * and the styles applied on the fragement. The styles determines font face
19 * used to show the text. The fragment of text with styles is called
20 * styled block.
21 */
22
15 /*! \defgroup fontconfig_freetype Fontconfig and FreeType Layer. 23 /*! \defgroup fontconfig_freetype Fontconfig and FreeType Layer.
16 * 24 *
17 * This layer implements a font provider to reset of the system. 25 * This layer implements a font provider to reset of the system.
18 * It bases on fontconfig and FreeType supporting of Cairo. 26 * It bases on fontconfig and FreeType supporting of Cairo.
19 * 27 *
29 37
30 /*! \brief Stakeholder of scaled font. 38 /*! \brief Stakeholder of scaled font.
31 * 39 *
32 * Although, mb_text_extents_t is defined as a cairo_scaled_font_t, but 40 * Although, mb_text_extents_t is defined as a cairo_scaled_font_t, but
33 * programmers should assume it is opague. 41 * programmers should assume it is opague.
42 *
43 * An extents is the span of showing a fragement of text on the output device.
44 * It includes x and y advance of cursor after showinng the text.
45 * The cursor maybe not really existed. But, the advance is computed as
46 * the cursor existed. It also includes width and height of the text.
47 * The bearing of a styled block is the left-top corner of the bounding box.
48 * The bounding box of a styled block is the minimal rectangle, on the
49 * output device, that can contain the text. The bearing is related to
50 * the base line for an extents.
34 */ 51 */
35 typedef cairo_text_extents_t mb_text_extents_t; 52 typedef cairo_text_extents_t mb_text_extents_t;
36 53
37 #define MBE_GET_X_ADV(ext) ((ext)->x_advance) 54 #define MBE_GET_X_ADV(ext) ((ext)->x_advance)
38 #define MBE_GET_Y_ADV(ext) ((ext)->y_advance) 55 #define MBE_GET_Y_ADV(ext) ((ext)->y_advance)
312 * blocks should be computed separated, collected, and aggreagated 329 * blocks should be computed separated, collected, and aggreagated
313 * into a full extents. 330 * into a full extents.
314 */ 331 */
315 static 332 static
316 void extent_extents(mb_text_extents_t *full, mb_text_extents_t *sub) { 333 void extent_extents(mb_text_extents_t *full, mb_text_extents_t *sub) {
317 co_aix f_rbx, f_rby; 334 co_aix f_rbx, f_rby; /* rb stands for right button */
318 co_aix s_rbx, s_rby; 335 co_aix s_rbx, s_rby;
319 336
320 f_rbx = MBE_GET_X_BEARING(full) + MBE_GET_WIDTH(full); 337 f_rbx = MBE_GET_X_BEARING(full) + MBE_GET_WIDTH(full);
321 f_rby = MBE_GET_Y_BEARING(full) + MBE_GET_HEIGHT(full); 338 f_rby = MBE_GET_Y_BEARING(full) + MBE_GET_HEIGHT(full);
322 s_rbx = MBE_GET_X_BEARING(sub) + MBE_GET_WIDTH(sub); 339 s_rbx = MBE_GET_X_BEARING(sub) + MBE_GET_WIDTH(sub);