1 /****************************************************************************
2 *
3 * freetype.h
4 *
5 * FreeType high-level API and common types (specification only).
6 *
7 * Copyright (C) 1996-2019 by
8 * David Turner, Robert Wilhelm, and Werner Lemberg.
9 *
10 * This file is part of the FreeType project, and may only be used,
11 * modified, and distributed under the terms of the FreeType project
12 * license, LICENSE.TXT. By continuing to use, modify, or distribute
13 * this file you indicate that you have read the license and
14 * understand and accept it fully.
15 *
16 */
17
18
19 #ifndef FREETYPE_H_
20 #define FREETYPE_H_
21
22
23 #ifndef FT_FREETYPE_H
24 #error "`ft2build.h' hasn't been included yet!"
25 #error "Please always use macros to include FreeType header files."
26 #error "Example:"
27 #error " #include <ft2build.h>"
1222 #define FT_FACE_FLAG_CID_KEYED ( 1L << 12 )
1223 #define FT_FACE_FLAG_TRICKY ( 1L << 13 )
1224 #define FT_FACE_FLAG_COLOR ( 1L << 14 )
1225 #define FT_FACE_FLAG_VARIATION ( 1L << 15 )
1226
1227
1228 /**************************************************************************
1229 *
1230 * @macro:
1231 * FT_HAS_HORIZONTAL
1232 *
1233 * @description:
1234 * A macro that returns true whenever a face object contains horizontal
1235 * metrics (this is true for all font formats though).
1236 *
1237 * @also:
1238 * @FT_HAS_VERTICAL can be used to check for vertical metrics.
1239 *
1240 */
1241 #define FT_HAS_HORIZONTAL( face ) \
1242 ( (face)->face_flags & FT_FACE_FLAG_HORIZONTAL )
1243
1244
1245 /**************************************************************************
1246 *
1247 * @macro:
1248 * FT_HAS_VERTICAL
1249 *
1250 * @description:
1251 * A macro that returns true whenever a face object contains real
1252 * vertical metrics (and not only synthesized ones).
1253 *
1254 */
1255 #define FT_HAS_VERTICAL( face ) \
1256 ( (face)->face_flags & FT_FACE_FLAG_VERTICAL )
1257
1258
1259 /**************************************************************************
1260 *
1261 * @macro:
1262 * FT_HAS_KERNING
1263 *
1264 * @description:
1265 * A macro that returns true whenever a face object contains kerning data
1266 * that can be accessed with @FT_Get_Kerning.
1267 *
1268 */
1269 #define FT_HAS_KERNING( face ) \
1270 ( (face)->face_flags & FT_FACE_FLAG_KERNING )
1271
1272
1273 /**************************************************************************
1274 *
1275 * @macro:
1276 * FT_IS_SCALABLE
1277 *
1278 * @description:
1279 * A macro that returns true whenever a face object contains a scalable
1280 * font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF, and
1281 * PFR font formats).
1282 *
1283 */
1284 #define FT_IS_SCALABLE( face ) \
1285 ( (face)->face_flags & FT_FACE_FLAG_SCALABLE )
1286
1287
1288 /**************************************************************************
1289 *
1290 * @macro:
1291 * FT_IS_SFNT
1292 *
1293 * @description:
1294 * A macro that returns true whenever a face object contains a font whose
1295 * format is based on the SFNT storage scheme. This usually means:
1296 * TrueType fonts, OpenType fonts, as well as SFNT-based embedded bitmap
1297 * fonts.
1298 *
1299 * If this macro is true, all functions defined in @FT_SFNT_NAMES_H and
1300 * @FT_TRUETYPE_TABLES_H are available.
1301 *
1302 */
1303 #define FT_IS_SFNT( face ) \
1304 ( (face)->face_flags & FT_FACE_FLAG_SFNT )
1305
1306
1307 /**************************************************************************
1308 *
1309 * @macro:
1310 * FT_IS_FIXED_WIDTH
1311 *
1312 * @description:
1313 * A macro that returns true whenever a face object contains a font face
1314 * that contains fixed-width (or 'monospace', 'fixed-pitch', etc.)
1315 * glyphs.
1316 *
1317 */
1318 #define FT_IS_FIXED_WIDTH( face ) \
1319 ( (face)->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
1320
1321
1322 /**************************************************************************
1323 *
1324 * @macro:
1325 * FT_HAS_FIXED_SIZES
1326 *
1327 * @description:
1328 * A macro that returns true whenever a face object contains some
1329 * embedded bitmaps. See the `available_sizes` field of the @FT_FaceRec
1330 * structure.
1331 *
1332 */
1333 #define FT_HAS_FIXED_SIZES( face ) \
1334 ( (face)->face_flags & FT_FACE_FLAG_FIXED_SIZES )
1335
1336
1337 /**************************************************************************
1338 *
1339 * @macro:
1340 * FT_HAS_FAST_GLYPHS
1341 *
1342 * @description:
1343 * Deprecated.
1344 *
1345 */
1346 #define FT_HAS_FAST_GLYPHS( face ) 0
1347
1348
1349 /**************************************************************************
1350 *
1351 * @macro:
1352 * FT_HAS_GLYPH_NAMES
1353 *
1354 * @description:
1355 * A macro that returns true whenever a face object contains some glyph
1356 * names that can be accessed through @FT_Get_Glyph_Name.
1357 *
1358 */
1359 #define FT_HAS_GLYPH_NAMES( face ) \
1360 ( (face)->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
1361
1362
1363 /**************************************************************************
1364 *
1365 * @macro:
1366 * FT_HAS_MULTIPLE_MASTERS
1367 *
1368 * @description:
1369 * A macro that returns true whenever a face object contains some
1370 * multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H
1371 * are then available to choose the exact design you want.
1372 *
1373 */
1374 #define FT_HAS_MULTIPLE_MASTERS( face ) \
1375 ( (face)->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
1376
1377
1378 /**************************************************************************
1379 *
1380 * @macro:
1381 * FT_IS_NAMED_INSTANCE
1382 *
1383 * @description:
1384 * A macro that returns true whenever a face object is a named instance
1385 * of a GX or OpenType variation font.
1386 *
1387 * [Since 2.9] Changing the design coordinates with
1388 * @FT_Set_Var_Design_Coordinates or @FT_Set_Var_Blend_Coordinates does
1389 * not influence the return value of this macro (only
1390 * @FT_Set_Named_Instance does that).
1391 *
1392 * @since:
1393 * 2.7
1394 *
1395 */
1396 #define FT_IS_NAMED_INSTANCE( face ) \
1397 ( (face)->face_index & 0x7FFF0000L )
1398
1399
1400 /**************************************************************************
1401 *
1402 * @macro:
1403 * FT_IS_VARIATION
1404 *
1405 * @description:
1406 * A macro that returns true whenever a face object has been altered by
1407 * @FT_Set_MM_Design_Coordinates, @FT_Set_Var_Design_Coordinates, or
1408 * @FT_Set_Var_Blend_Coordinates.
1409 *
1410 * @since:
1411 * 2.9
1412 *
1413 */
1414 #define FT_IS_VARIATION( face ) \
1415 ( (face)->face_flags & FT_FACE_FLAG_VARIATION )
1416
1417
1418 /**************************************************************************
1419 *
1420 * @macro:
1421 * FT_IS_CID_KEYED
1422 *
1423 * @description:
1424 * A macro that returns true whenever a face object contains a CID-keyed
1425 * font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more details.
1426 *
1427 * If this macro is true, all functions defined in @FT_CID_H are
1428 * available.
1429 *
1430 */
1431 #define FT_IS_CID_KEYED( face ) \
1432 ( (face)->face_flags & FT_FACE_FLAG_CID_KEYED )
1433
1434
1435 /**************************************************************************
1436 *
1437 * @macro:
1438 * FT_IS_TRICKY
1439 *
1440 * @description:
1441 * A macro that returns true whenever a face represents a 'tricky' font.
1442 * See the discussion of @FT_FACE_FLAG_TRICKY for more details.
1443 *
1444 */
1445 #define FT_IS_TRICKY( face ) \
1446 ( (face)->face_flags & FT_FACE_FLAG_TRICKY )
1447
1448
1449 /**************************************************************************
1450 *
1451 * @macro:
1452 * FT_HAS_COLOR
1453 *
1454 * @description:
1455 * A macro that returns true whenever a face object contains tables for
1456 * color glyphs.
1457 *
1458 * @since:
1459 * 2.5.1
1460 *
1461 */
1462 #define FT_HAS_COLOR( face ) \
1463 ( (face)->face_flags & FT_FACE_FLAG_COLOR )
1464
1465
1466 /**************************************************************************
1467 *
1468 * @enum:
1469 * FT_STYLE_FLAG_XXX
1470 *
1471 * @description:
1472 * A list of bit flags to indicate the style of a given face. These are
1473 * used in the `style_flags` field of @FT_FaceRec.
1474 *
1475 * @values:
1476 * FT_STYLE_FLAG_ITALIC ::
1477 * The face style is italic or oblique.
1478 *
1479 * FT_STYLE_FLAG_BOLD ::
1480 * The face is bold.
1481 *
1482 * @note:
1483 * The style information as provided by FreeType is very basic. More
2061 *
2062 * @struct:
2063 * FT_Open_Args
2064 *
2065 * @description:
2066 * A structure to indicate how to open a new font file or stream. A
2067 * pointer to such a structure can be used as a parameter for the
2068 * functions @FT_Open_Face and @FT_Attach_Stream.
2069 *
2070 * @fields:
2071 * flags ::
2072 * A set of bit flags indicating how to use the structure.
2073 *
2074 * memory_base ::
2075 * The first byte of the file in memory.
2076 *
2077 * memory_size ::
2078 * The size in bytes of the file in memory.
2079 *
2080 * pathname ::
2081 * A pointer to an 8-bit file pathname.
2082 *
2083 * stream ::
2084 * A handle to a source stream object.
2085 *
2086 * driver ::
2087 * This field is exclusively used by @FT_Open_Face; it simply specifies
2088 * the font driver to use for opening the face. If set to `NULL`,
2089 * FreeType tries to load the face with each one of the drivers in its
2090 * list.
2091 *
2092 * num_params ::
2093 * The number of extra parameters.
2094 *
2095 * params ::
2096 * Extra parameters passed to the font driver when opening a new face.
2097 *
2098 * @note:
2099 * The stream type is determined by the contents of `flags` that are
2100 * tested in the following order by @FT_Open_Face:
2101 *
4764 *
4765 * @description:
4766 * These three macros identify the FreeType source code version. Use
4767 * @FT_Library_Version to access them at runtime.
4768 *
4769 * @values:
4770 * FREETYPE_MAJOR ::
4771 * The major version number.
4772 * FREETYPE_MINOR ::
4773 * The minor version number.
4774 * FREETYPE_PATCH ::
4775 * The patch level.
4776 *
4777 * @note:
4778 * The version number of FreeType if built as a dynamic link library with
4779 * the 'libtool' package is _not_ controlled by these three macros.
4780 *
4781 */
4782 #define FREETYPE_MAJOR 2
4783 #define FREETYPE_MINOR 10
4784 #define FREETYPE_PATCH 1
4785
4786
4787 /**************************************************************************
4788 *
4789 * @function:
4790 * FT_Library_Version
4791 *
4792 * @description:
4793 * Return the version of the FreeType library being used. This is useful
4794 * when dynamically linking to the library, since one cannot use the
4795 * macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and @FREETYPE_PATCH.
4796 *
4797 * @input:
4798 * library ::
4799 * A source library handle.
4800 *
4801 * @output:
4802 * amajor ::
4803 * The major version number.
4804 *
|
1 /****************************************************************************
2 *
3 * freetype.h
4 *
5 * FreeType high-level API and common types (specification only).
6 *
7 * Copyright (C) 1996-2020 by
8 * David Turner, Robert Wilhelm, and Werner Lemberg.
9 *
10 * This file is part of the FreeType project, and may only be used,
11 * modified, and distributed under the terms of the FreeType project
12 * license, LICENSE.TXT. By continuing to use, modify, or distribute
13 * this file you indicate that you have read the license and
14 * understand and accept it fully.
15 *
16 */
17
18
19 #ifndef FREETYPE_H_
20 #define FREETYPE_H_
21
22
23 #ifndef FT_FREETYPE_H
24 #error "`ft2build.h' hasn't been included yet!"
25 #error "Please always use macros to include FreeType header files."
26 #error "Example:"
27 #error " #include <ft2build.h>"
1222 #define FT_FACE_FLAG_CID_KEYED ( 1L << 12 )
1223 #define FT_FACE_FLAG_TRICKY ( 1L << 13 )
1224 #define FT_FACE_FLAG_COLOR ( 1L << 14 )
1225 #define FT_FACE_FLAG_VARIATION ( 1L << 15 )
1226
1227
1228 /**************************************************************************
1229 *
1230 * @macro:
1231 * FT_HAS_HORIZONTAL
1232 *
1233 * @description:
1234 * A macro that returns true whenever a face object contains horizontal
1235 * metrics (this is true for all font formats though).
1236 *
1237 * @also:
1238 * @FT_HAS_VERTICAL can be used to check for vertical metrics.
1239 *
1240 */
1241 #define FT_HAS_HORIZONTAL( face ) \
1242 ( !!( (face)->face_flags & FT_FACE_FLAG_HORIZONTAL ) )
1243
1244
1245 /**************************************************************************
1246 *
1247 * @macro:
1248 * FT_HAS_VERTICAL
1249 *
1250 * @description:
1251 * A macro that returns true whenever a face object contains real
1252 * vertical metrics (and not only synthesized ones).
1253 *
1254 */
1255 #define FT_HAS_VERTICAL( face ) \
1256 ( !!( (face)->face_flags & FT_FACE_FLAG_VERTICAL ) )
1257
1258
1259 /**************************************************************************
1260 *
1261 * @macro:
1262 * FT_HAS_KERNING
1263 *
1264 * @description:
1265 * A macro that returns true whenever a face object contains kerning data
1266 * that can be accessed with @FT_Get_Kerning.
1267 *
1268 */
1269 #define FT_HAS_KERNING( face ) \
1270 ( !!( (face)->face_flags & FT_FACE_FLAG_KERNING ) )
1271
1272
1273 /**************************************************************************
1274 *
1275 * @macro:
1276 * FT_IS_SCALABLE
1277 *
1278 * @description:
1279 * A macro that returns true whenever a face object contains a scalable
1280 * font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF, and
1281 * PFR font formats).
1282 *
1283 */
1284 #define FT_IS_SCALABLE( face ) \
1285 ( !!( (face)->face_flags & FT_FACE_FLAG_SCALABLE ) )
1286
1287
1288 /**************************************************************************
1289 *
1290 * @macro:
1291 * FT_IS_SFNT
1292 *
1293 * @description:
1294 * A macro that returns true whenever a face object contains a font whose
1295 * format is based on the SFNT storage scheme. This usually means:
1296 * TrueType fonts, OpenType fonts, as well as SFNT-based embedded bitmap
1297 * fonts.
1298 *
1299 * If this macro is true, all functions defined in @FT_SFNT_NAMES_H and
1300 * @FT_TRUETYPE_TABLES_H are available.
1301 *
1302 */
1303 #define FT_IS_SFNT( face ) \
1304 ( !!( (face)->face_flags & FT_FACE_FLAG_SFNT ) )
1305
1306
1307 /**************************************************************************
1308 *
1309 * @macro:
1310 * FT_IS_FIXED_WIDTH
1311 *
1312 * @description:
1313 * A macro that returns true whenever a face object contains a font face
1314 * that contains fixed-width (or 'monospace', 'fixed-pitch', etc.)
1315 * glyphs.
1316 *
1317 */
1318 #define FT_IS_FIXED_WIDTH( face ) \
1319 ( !!( (face)->face_flags & FT_FACE_FLAG_FIXED_WIDTH ) )
1320
1321
1322 /**************************************************************************
1323 *
1324 * @macro:
1325 * FT_HAS_FIXED_SIZES
1326 *
1327 * @description:
1328 * A macro that returns true whenever a face object contains some
1329 * embedded bitmaps. See the `available_sizes` field of the @FT_FaceRec
1330 * structure.
1331 *
1332 */
1333 #define FT_HAS_FIXED_SIZES( face ) \
1334 ( !!( (face)->face_flags & FT_FACE_FLAG_FIXED_SIZES ) )
1335
1336
1337 /**************************************************************************
1338 *
1339 * @macro:
1340 * FT_HAS_FAST_GLYPHS
1341 *
1342 * @description:
1343 * Deprecated.
1344 *
1345 */
1346 #define FT_HAS_FAST_GLYPHS( face ) 0
1347
1348
1349 /**************************************************************************
1350 *
1351 * @macro:
1352 * FT_HAS_GLYPH_NAMES
1353 *
1354 * @description:
1355 * A macro that returns true whenever a face object contains some glyph
1356 * names that can be accessed through @FT_Get_Glyph_Name.
1357 *
1358 */
1359 #define FT_HAS_GLYPH_NAMES( face ) \
1360 ( !!( (face)->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) )
1361
1362
1363 /**************************************************************************
1364 *
1365 * @macro:
1366 * FT_HAS_MULTIPLE_MASTERS
1367 *
1368 * @description:
1369 * A macro that returns true whenever a face object contains some
1370 * multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H
1371 * are then available to choose the exact design you want.
1372 *
1373 */
1374 #define FT_HAS_MULTIPLE_MASTERS( face ) \
1375 ( !!( (face)->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS ) )
1376
1377
1378 /**************************************************************************
1379 *
1380 * @macro:
1381 * FT_IS_NAMED_INSTANCE
1382 *
1383 * @description:
1384 * A macro that returns true whenever a face object is a named instance
1385 * of a GX or OpenType variation font.
1386 *
1387 * [Since 2.9] Changing the design coordinates with
1388 * @FT_Set_Var_Design_Coordinates or @FT_Set_Var_Blend_Coordinates does
1389 * not influence the return value of this macro (only
1390 * @FT_Set_Named_Instance does that).
1391 *
1392 * @since:
1393 * 2.7
1394 *
1395 */
1396 #define FT_IS_NAMED_INSTANCE( face ) \
1397 ( !!( (face)->face_index & 0x7FFF0000L ) )
1398
1399
1400 /**************************************************************************
1401 *
1402 * @macro:
1403 * FT_IS_VARIATION
1404 *
1405 * @description:
1406 * A macro that returns true whenever a face object has been altered by
1407 * @FT_Set_MM_Design_Coordinates, @FT_Set_Var_Design_Coordinates, or
1408 * @FT_Set_Var_Blend_Coordinates.
1409 *
1410 * @since:
1411 * 2.9
1412 *
1413 */
1414 #define FT_IS_VARIATION( face ) \
1415 ( !!( (face)->face_flags & FT_FACE_FLAG_VARIATION ) )
1416
1417
1418 /**************************************************************************
1419 *
1420 * @macro:
1421 * FT_IS_CID_KEYED
1422 *
1423 * @description:
1424 * A macro that returns true whenever a face object contains a CID-keyed
1425 * font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more details.
1426 *
1427 * If this macro is true, all functions defined in @FT_CID_H are
1428 * available.
1429 *
1430 */
1431 #define FT_IS_CID_KEYED( face ) \
1432 ( !!( (face)->face_flags & FT_FACE_FLAG_CID_KEYED ) )
1433
1434
1435 /**************************************************************************
1436 *
1437 * @macro:
1438 * FT_IS_TRICKY
1439 *
1440 * @description:
1441 * A macro that returns true whenever a face represents a 'tricky' font.
1442 * See the discussion of @FT_FACE_FLAG_TRICKY for more details.
1443 *
1444 */
1445 #define FT_IS_TRICKY( face ) \
1446 ( !!( (face)->face_flags & FT_FACE_FLAG_TRICKY ) )
1447
1448
1449 /**************************************************************************
1450 *
1451 * @macro:
1452 * FT_HAS_COLOR
1453 *
1454 * @description:
1455 * A macro that returns true whenever a face object contains tables for
1456 * color glyphs.
1457 *
1458 * @since:
1459 * 2.5.1
1460 *
1461 */
1462 #define FT_HAS_COLOR( face ) \
1463 ( !!( (face)->face_flags & FT_FACE_FLAG_COLOR ) )
1464
1465
1466 /**************************************************************************
1467 *
1468 * @enum:
1469 * FT_STYLE_FLAG_XXX
1470 *
1471 * @description:
1472 * A list of bit flags to indicate the style of a given face. These are
1473 * used in the `style_flags` field of @FT_FaceRec.
1474 *
1475 * @values:
1476 * FT_STYLE_FLAG_ITALIC ::
1477 * The face style is italic or oblique.
1478 *
1479 * FT_STYLE_FLAG_BOLD ::
1480 * The face is bold.
1481 *
1482 * @note:
1483 * The style information as provided by FreeType is very basic. More
2061 *
2062 * @struct:
2063 * FT_Open_Args
2064 *
2065 * @description:
2066 * A structure to indicate how to open a new font file or stream. A
2067 * pointer to such a structure can be used as a parameter for the
2068 * functions @FT_Open_Face and @FT_Attach_Stream.
2069 *
2070 * @fields:
2071 * flags ::
2072 * A set of bit flags indicating how to use the structure.
2073 *
2074 * memory_base ::
2075 * The first byte of the file in memory.
2076 *
2077 * memory_size ::
2078 * The size in bytes of the file in memory.
2079 *
2080 * pathname ::
2081 * A pointer to an 8-bit file pathname. The pointer is not owned by
2082 * FreeType.
2083 *
2084 * stream ::
2085 * A handle to a source stream object.
2086 *
2087 * driver ::
2088 * This field is exclusively used by @FT_Open_Face; it simply specifies
2089 * the font driver to use for opening the face. If set to `NULL`,
2090 * FreeType tries to load the face with each one of the drivers in its
2091 * list.
2092 *
2093 * num_params ::
2094 * The number of extra parameters.
2095 *
2096 * params ::
2097 * Extra parameters passed to the font driver when opening a new face.
2098 *
2099 * @note:
2100 * The stream type is determined by the contents of `flags` that are
2101 * tested in the following order by @FT_Open_Face:
2102 *
4765 *
4766 * @description:
4767 * These three macros identify the FreeType source code version. Use
4768 * @FT_Library_Version to access them at runtime.
4769 *
4770 * @values:
4771 * FREETYPE_MAJOR ::
4772 * The major version number.
4773 * FREETYPE_MINOR ::
4774 * The minor version number.
4775 * FREETYPE_PATCH ::
4776 * The patch level.
4777 *
4778 * @note:
4779 * The version number of FreeType if built as a dynamic link library with
4780 * the 'libtool' package is _not_ controlled by these three macros.
4781 *
4782 */
4783 #define FREETYPE_MAJOR 2
4784 #define FREETYPE_MINOR 10
4785 #define FREETYPE_PATCH 2
4786
4787
4788 /**************************************************************************
4789 *
4790 * @function:
4791 * FT_Library_Version
4792 *
4793 * @description:
4794 * Return the version of the FreeType library being used. This is useful
4795 * when dynamically linking to the library, since one cannot use the
4796 * macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and @FREETYPE_PATCH.
4797 *
4798 * @input:
4799 * library ::
4800 * A source library handle.
4801 *
4802 * @output:
4803 * amajor ::
4804 * The major version number.
4805 *
|