Enlightenment CVS committal Author : kwo Project : e17 Module : libs/imlib2
Dir : e17/libs/imlib2/src/lib Modified Files: api.c font_draw.c font_load.c font_query.c Log Message: Indent, rewrap long comment lines. =================================================================== RCS file: /cvs/e/e17/libs/imlib2/src/lib/api.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -3 -r1.16 -r1.17 --- api.c 23 Jul 2007 14:27:44 -0000 1.16 +++ api.c 27 Jul 2007 17:26:58 -0000 1.17 @@ -3105,51 +3105,60 @@ ctx->font = NULL; } - /** * @param font A previously loaded font. * @param fallback_font A previously loaded font to be chained to the given font. * @return 0 on success. * - * This arranges for the given fallback font to be used if a glyph does not exist in the given font when text is being rendered. - * Fonts can be arranged in an aribitrarily long chain and attempts will be made in order on the chain. - * Cycles in the chain are not possible since the given fallback font is removed from any chain it's already in. - * A fallback font may be a member of only one chain. Adding it as the fallback font to another font will remove it from it's first fallback chain. + * This arranges for the given fallback font to be used if a glyph does not + * exist in the given font when text is being rendered. + * Fonts can be arranged in an aribitrarily long chain and attempts will be + * made in order on the chain. + * Cycles in the chain are not possible since the given fallback font is + * removed from any chain it's already in. + * A fallback font may be a member of only one chain. Adding it as the + * fallback font to another font will remove it from it's first fallback chain. **/ -EAPI int +EAPI int imlib_insert_font_into_fallback_chain(Imlib_Font font, Imlib_Font fallback_font) { - CHECK_PARAM_POINTER_RETURN("imlib_insert_font_into_fallback_chain", "font", font, 1); - CHECK_PARAM_POINTER_RETURN("imlib_insert_font_into_fallback_chain", "fallback_font", fallback_font, 1); - return imlib_insert_font_into_fallback_chain_imp(font,fallback_font); + CHECK_PARAM_POINTER_RETURN("imlib_insert_font_into_fallback_chain", + "font", font, 1); + CHECK_PARAM_POINTER_RETURN("imlib_insert_font_into_fallback_chain", + "fallback_font", fallback_font, 1); + return imlib_insert_font_into_fallback_chain_imp(font, fallback_font); } /** - * @param fallback_font A font previously added to a fallback chain + * @param fallback_font A font previously added to a fallback chain. * @return 0 on success. * * This removes the given font from any fallback chain it may be in. - * Removing this font joins its previous and next font together in the fallback chain. + * Removing this font joins its previous and next font together in the fallback + * chain. **/ -EAPI void +EAPI void imlib_remove_font_from_fallback_chain(Imlib_Font fallback_font) { - CHECK_PARAM_POINTER("imlib_remove_font_from_fallback_chain", "fallback_font", fallback_font); + CHECK_PARAM_POINTER("imlib_remove_font_from_fallback_chain", + "fallback_font", fallback_font); imlib_remove_font_from_fallback_chain_imp(fallback_font); } -EAPI Imlib_Font +EAPI Imlib_Font imlib_get_prev_font_in_fallback_chain(Imlib_Font fn) { - CHECK_PARAM_POINTER_RETURN("imlib_get_prev_font_in_fallback_chain", "fn", fn, 0); - return ((ImlibFont*)fn)->fallback_prev; + CHECK_PARAM_POINTER_RETURN("imlib_get_prev_font_in_fallback_chain", + "fn", fn, 0); + return ((ImlibFont *) fn)->fallback_prev; } -EAPI Imlib_Font +EAPI Imlib_Font imlib_get_next_font_in_fallback_chain(Imlib_Font fn) { - CHECK_PARAM_POINTER_RETURN("imlib_get_next_font_in_fallback_chain", "fn", fn, 0); - return ((ImlibFont*)fn)->fallback_next; + CHECK_PARAM_POINTER_RETURN("imlib_get_next_font_in_fallback_chain", + "fn", fn, 0); + return ((ImlibFont *) fn)->fallback_next; } /** =================================================================== RCS file: /cvs/e/e17/libs/imlib2/src/lib/font_draw.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- font_draw.c 23 Jul 2007 14:27:44 -0000 1.10 +++ font_draw.c 27 Jul 2007 17:26:58 -0000 1.11 @@ -246,28 +246,33 @@ } /* - * This function returns the first font in the fallback chain to contain the requested glyph. + * This function returns the first font in the fallback chain to contain + * the requested glyph. * The glyph index is returned in ret_index - * If the glyph is not found, then the given font pointer is returned and ret_index will be set to 0 + * If the glyph is not found, then the given font pointer is returned and + * ret_index will be set to 0 */ -ImlibFont * +ImlibFont * imlib_find_glyph_in_font_chain(ImlibFont * first_fn, int gl, int *ret_index) { - ImlibFont *fn = first_fn; - do - { - int index = FT_Get_Char_Index(fn->ft.face, gl); - if(index<=0) - fn = fn->fallback_next; - else - { - (*ret_index) = index; - return fn; - } - } while(fn); + ImlibFont *fn = first_fn; - (*ret_index) = 0; - return first_fn; + do + { + int index = FT_Get_Char_Index(fn->ft.face, gl); + + if (index <= 0) + fn = fn->fallback_next; + else + { + (*ret_index) = index; + return fn; + } + } + while (fn); + + (*ret_index) = 0; + return first_fn; } void @@ -335,20 +340,20 @@ { FT_UInt index; Imlib_Font_Glyph *fg; - ImlibFont *fn_in_chain; + ImlibFont *fn_in_chain; int chr_x, chr_y; int gl; gl = imlib_font_utf8_get_next((unsigned char *)text, &chr); if (gl == 0) break; - fn_in_chain = imlib_find_glyph_in_font_chain(fn, gl, &index); + fn_in_chain = imlib_find_glyph_in_font_chain(fn, gl, &index); if ((use_kerning) && (prev_index) && (index)) { FT_Vector delta; - FT_Get_Kerning(fn_in_chain->ft.face, prev_index, index, ft_kerning_default, - &delta); + FT_Get_Kerning(fn_in_chain->ft.face, prev_index, index, + ft_kerning_default, &delta); pen_x += delta.x << 2; } fg = imlib_font_cache_glyph_get(fn_in_chain, index); =================================================================== RCS file: /cvs/e/e17/libs/imlib2/src/lib/font_load.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- font_load.c 23 Jul 2007 14:27:44 -0000 1.4 +++ font_load.c 27 Jul 2007 17:26:58 -0000 1.5 @@ -204,33 +204,34 @@ } int -imlib_insert_font_into_fallback_chain_imp(ImlibFont * fn, ImlibFont *fallback) +imlib_insert_font_into_fallback_chain_imp(ImlibFont * fn, ImlibFont * fallback) { - /* avoid infinite recursion */ - if(fn == fallback) - return 1; - - /* now remove the given fallback font from any chain it's already in */ - imlib_remove_font_from_fallback_chain_imp(fallback); + /* avoid infinite recursion */ + if (fn == fallback) + return 1; - /* insert fallback into fn's font chain */ - ImlibFont *tmp=fn->fallback_next; - fn->fallback_next = fallback; - fallback->fallback_prev = fn; - fallback->fallback_next = tmp; - if (tmp) - tmp->fallback_prev = fallback; - return 0; + /* now remove the given fallback font from any chain it's already in */ + imlib_remove_font_from_fallback_chain_imp(fallback); + + /* insert fallback into fn's font chain */ + ImlibFont *tmp = fn->fallback_next; + + fn->fallback_next = fallback; + fallback->fallback_prev = fn; + fallback->fallback_next = tmp; + if (tmp) + tmp->fallback_prev = fallback; + return 0; } void -imlib_remove_font_from_fallback_chain_imp(ImlibFont *fn) +imlib_remove_font_from_fallback_chain_imp(ImlibFont * fn) { - /* if fn has a previous font in its font chain, then make its fallback_next fn's fallback_next since fn is going away */ - if(fn->fallback_prev) - fn->fallback_prev->fallback_next=fn->fallback_next; - fn->fallback_prev = NULL; - fn->fallback_next = NULL; + /* if fn has a previous font in its font chain, then make its fallback_next fn's fallback_next since fn is going away */ + if (fn->fallback_prev) + fn->fallback_prev->fallback_next = fn->fallback_next; + fn->fallback_prev = NULL; + fn->fallback_next = NULL; } static int =================================================================== RCS file: /cvs/e/e17/libs/imlib2/src/lib/font_query.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- font_query.c 23 Jul 2007 14:27:44 -0000 1.4 +++ font_query.c 27 Jul 2007 17:26:58 -0000 1.5 @@ -15,8 +15,7 @@ #include "rgbadraw.h" #include "rotate.h" -extern ImlibFont * -imlib_find_glyph_in_font_chain(ImlibFont * first_fn, int gl, int *ret_index); /* defined in font_draw.c */ +extern ImlibFont *imlib_find_glyph_in_font_chain(ImlibFont * first_fn, int gl, int *ret_index); /* defined in font_draw.c */ extern FT_Library ft_lib; @@ -40,20 +39,20 @@ { FT_UInt index; Imlib_Font_Glyph *fg; - ImlibFont *fn_in_chain; + ImlibFont *fn_in_chain; int chr_x, chr_y, chr_w; int gl; gl = imlib_font_utf8_get_next((unsigned char *)text, &chr); if (gl == 0) break; - fn_in_chain = imlib_find_glyph_in_font_chain(fn, gl, &index); + fn_in_chain = imlib_find_glyph_in_font_chain(fn, gl, &index); if ((use_kerning) && (prev_index) && (index)) { FT_Vector delta; - FT_Get_Kerning(fn_in_chain->ft.face, prev_index, index, ft_kerning_default, - &delta); + FT_Get_Kerning(fn_in_chain->ft.face, prev_index, index, + ft_kerning_default, &delta); pen_x += delta.x << 2; } fg = imlib_font_cache_glyph_get(fn_in_chain, index); @@ -75,7 +74,7 @@ if (w) *w = (pen_x >> 8) - start_x; if (h) - *h = imlib_font_max_ascent_get(fn) - imlib_font_max_descent_get(fn); /* TODO: compute this inside the loop since we now may be dealing with multiple fonts */ + *h = imlib_font_max_ascent_get(fn) - imlib_font_max_descent_get(fn); /* TODO: compute this inside the loop since we now may be dealing with multiple fonts */ } /* text x inset */ @@ -84,7 +83,7 @@ { FT_UInt index; Imlib_Font_Glyph *fg; - ImlibFont *fn_in_chain; + ImlibFont *fn_in_chain; int chr; int gl; @@ -121,20 +120,20 @@ { FT_UInt index; Imlib_Font_Glyph *fg; - ImlibFont *fn_in_chain; + ImlibFont *fn_in_chain; int chr_x, chr_y, chr_w; int gl; gl = imlib_font_utf8_get_next((unsigned char *)text, &chr); if (gl == 0) break; - fn_in_chain = imlib_find_glyph_in_font_chain(fn, gl, &index); + fn_in_chain = imlib_find_glyph_in_font_chain(fn, gl, &index); if ((use_kerning) && (prev_index) && (index)) { FT_Vector delta; - FT_Get_Kerning(fn_in_chain->ft.face, prev_index, index, ft_kerning_default, - &delta); + FT_Get_Kerning(fn_in_chain->ft.face, prev_index, index, + ft_kerning_default, &delta); pen_x += delta.x << 2; } fg = imlib_font_cache_glyph_get(fn_in_chain, index); @@ -178,7 +177,7 @@ int pchr; FT_UInt index; Imlib_Font_Glyph *fg; - ImlibFont *fn_in_chain; + ImlibFont *fn_in_chain; int chr_x, chr_y, chr_w; int gl, kern; FT_Vector delta; @@ -187,12 +186,12 @@ gl = imlib_font_utf8_get_next((unsigned char *)text, &chr); if (gl == 0) break; - fn_in_chain = imlib_find_glyph_in_font_chain(fn, gl, &index); + fn_in_chain = imlib_find_glyph_in_font_chain(fn, gl, &index); kern = 0; if ((use_kerning) && (prev_index) && (index)) { - FT_Get_Kerning(fn_in_chain->ft.face, prev_index, index, ft_kerning_default, - &delta); + FT_Get_Kerning(fn_in_chain->ft.face, prev_index, index, + ft_kerning_default, &delta); kern = delta.x << 2; pen_x += kern; } @@ -261,7 +260,7 @@ int pchr; FT_UInt index; Imlib_Font_Glyph *fg; - ImlibFont *fn_in_chain; + ImlibFont *fn_in_chain; int chr_x, chr_y, chr_w; int gl, kern; FT_Vector delta; @@ -270,12 +269,12 @@ gl = imlib_font_utf8_get_next((unsigned char *)text, &chr); if (gl == 0) break; - fn_in_chain = imlib_find_glyph_in_font_chain(fn, gl, &index); + fn_in_chain = imlib_find_glyph_in_font_chain(fn, gl, &index); kern = 0; if ((use_kerning) && (prev_index) && (index)) { - FT_Get_Kerning(fn_in_chain->ft.face, prev_index, index, ft_kerning_default, - &delta); + FT_Get_Kerning(fn_in_chain->ft.face, prev_index, index, + ft_kerning_default, &delta); kern = delta.x << 2; pen_x += kern; } ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs