00001 /***************************************************************************/ 00002 /* */ 00003 /* ftgasp.c */ 00004 /* */ 00005 /* Access of TrueType's `gasp' table (body). */ 00006 /* */ 00007 /* Copyright 2007 by */ 00008 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 00009 /* */ 00010 /* This file is part of the FreeType project, and may only be used, */ 00011 /* modified, and distributed under the terms of the FreeType project */ 00012 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 00013 /* this file you indicate that you have read the license and */ 00014 /* understand and accept it fully. */ 00015 /* */ 00016 /***************************************************************************/ 00017 00018 00019 #include <ft2build.h> 00020 #include FT_GASP_H 00021 #include FT_INTERNAL_TRUETYPE_TYPES_H 00022 00023 00024 FT_EXPORT_DEF( FT_Int ) 00025 FT_Get_Gasp( FT_Face face, 00026 FT_UInt ppem ) 00027 { 00028 FT_Int result = FT_GASP_NO_TABLE; 00029 00030 00031 if ( face && FT_IS_SFNT( face ) ) 00032 { 00033 TT_Face ttface = (TT_Face)face; 00034 00035 00036 if ( ttface->gasp.numRanges > 0 ) 00037 { 00038 TT_GaspRange range = ttface->gasp.gaspRanges; 00039 TT_GaspRange range_end = range + ttface->gasp.numRanges; 00040 00041 00042 while ( ppem > range->maxPPEM ) 00043 { 00044 range++; 00045 if ( range >= range_end ) 00046 goto Exit; 00047 } 00048 00049 result = range->gaspFlag; 00050 00051 /* ensure that we don't have spurious bits */ 00052 if ( ttface->gasp.version == 0 ) 00053 result &= 3; 00054 } 00055 } 00056 Exit: 00057 return result; 00058 } 00059 00060 00061 /* END */