Author: tkreuzer Date: Mon May 16 15:37:23 2011 New Revision: 51789
URL: http://svn.reactos.org/svn/reactos?rev=51789&view=rev Log: [GDI FONT DRIVER] eleminate gotos
Modified: branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/font.c
Modified: branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/font.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/drivers/... ============================================================================== --- branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/font.c [iso-8859-1] (original) +++ branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/font.c [iso-8859-1] Mon May 16 15:37:23 2011 @@ -22,34 +22,35 @@ { /* Load the glyph into the glyph slot */ fterror = FT_Load_Char(ftface, wc, FT_LOAD_NO_SCALE|FT_LOAD_NO_BITMAP); - if (fterror) goto allglyphs; + if (fterror) break;
/* Calculate accumulative char width */ ulAccumCharWidth += ftface->glyph->metrics.width; cGlyphs++; } - goto done; - -allglyphs: - TRACE("using all glyphs\n"); - - /* Start over */ - ulAccumCharWidth = 0; - cGlyphs = 0; - - /* Loop all glyphs in the font */ - for (index = 0; index <= (UINT)ftface->num_glyphs; index++) - { - /* Load the glyph into the glyph slot */ - fterror = FT_Load_Glyph(ftface, index, FT_LOAD_NO_SCALE|FT_LOAD_NO_BITMAP); - if (fterror) continue; - - /* Calculate accumulative char width */ - ulAccumCharWidth += ftface->glyph->metrics.width; // FIXME: weighted - cGlyphs++; - } - -done: + + /* Check if an error occured */ + if (wc <= L'z') + { + TRACE("using all glyphs\n"); + + /* Start over */ + ulAccumCharWidth = 0; + cGlyphs = 0; + + /* Loop all glyphs in the font */ + for (index = 0; index <= (UINT)ftface->num_glyphs; index++) + { + /* Load the glyph into the glyph slot */ + fterror = FT_Load_Glyph(ftface, index, FT_LOAD_NO_SCALE|FT_LOAD_NO_BITMAP); + if (fterror) continue; + + /* Calculate accumulative char width */ + ulAccumCharWidth += ftface->glyph->metrics.width; // FIXME: weighted + cGlyphs++; + } + } + return (FWORD)(ulAccumCharWidth / cGlyphs); }