├── libs ├── libz.a └── libfreetype.a ├── DroidSansMono.ttf ├── messages.h ├── functions.h ├── console.h ├── device.h ├── fbtruetype.h ├── ChangeLog ├── ttf.h ├── Makefile ├── console.c ├── include ├── freetype2 │ └── freetype │ │ ├── config │ │ ├── ftmodule.h │ │ └── ftstdlib.h │ │ ├── ttunpat.h │ │ ├── ftsynth.h │ │ ├── ftlzw.h │ │ ├── ftgzip.h │ │ ├── ftbzip2.h │ │ ├── ftxf86.h │ │ ├── ftgasp.h │ │ ├── tttags.h │ │ ├── ftbbox.h │ │ ├── ftcid.h │ │ ├── ftpfr.h │ │ ├── ftchapters.h │ │ ├── ftbdf.h │ │ ├── ftotval.h │ │ ├── ftmoderr.h │ │ ├── ftlcdfil.h │ │ ├── ftsizes.h │ │ ├── fttrigon.h │ │ ├── fterrors.h │ │ ├── ftadvanc.h │ │ ├── ftwinfnt.h │ │ ├── ftsystem.h │ │ └── ftsnames.h └── ft2build.h ├── messages.c ├── functions.c ├── test └── devinfo.sh ├── fbtruetype.c ├── README.md └── device.c /libs/libz.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikelinux/fbtruetype-android/HEAD/libs/libz.a -------------------------------------------------------------------------------- /DroidSansMono.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikelinux/fbtruetype-android/HEAD/DroidSansMono.ttf -------------------------------------------------------------------------------- /libs/libfreetype.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikelinux/fbtruetype-android/HEAD/libs/libfreetype.a -------------------------------------------------------------------------------- /messages.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fbtruetype-android 3 | * 4 | * (c) 2015 by Michael Higham, 5 | * 6 | * This program is based on fbtruetype, written and (C) by 7 | * (c) 2001-2002 by Stefan Reinauer, 8 | * 9 | * This program my be redistributed under the terms of the 10 | * GNU General Public Licence, version 2, or at your preference, 11 | * any later version. 12 | */ 13 | 14 | #ifndef __MESSAGES_H 15 | #define __MESSAGES_H 16 | 17 | extern void usage(char *name); 18 | extern void version(void); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /functions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fbtruetype-android 3 | * 4 | * (c) 2015 by Michael Higham, 5 | * 6 | * This program is based on fbtruetype, written and (C) by 7 | * (c) 2001-2002 by Stefan Reinauer, 8 | * 9 | * This program my be redistributed under the terms of the 10 | * GNU General Public Licence, version 2, or at your preference, 11 | * any later version. 12 | */ 13 | 14 | #ifndef __FUNCTIONS_H 15 | #define __FUNCTIONS_H 16 | 17 | extern int strwrap(char * s, int w, char *** line_ret, int ** len_ret); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /console.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fbtruetype-android 3 | * 4 | * (c) 2015 by Michael Higham, 5 | * 6 | * This program is based on fbtruetype, written and (C) by 7 | * (c) 2001-2002 by Stefan Reinauer, 8 | * 9 | * This program my be redistributed under the terms of the 10 | * GNU General Public Licence, version 2, or at your preference, 11 | * any later version. 12 | */ 13 | 14 | #ifndef __CONSOLES_H 15 | #define __CONSOLES_H 16 | 17 | extern void init_consoles(void); 18 | extern int current_console(void); 19 | extern int start_console; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /device.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fbtruetype-android 3 | * 4 | * (c) 2015 by Michael Higham, 5 | * 6 | * This program is based on fbtruetype, written and (C) by 7 | * (c) 2001-2002 by Stefan Reinauer, 8 | * 9 | * This program my be redistributed under the terms of the 10 | * GNU General Public Licence, version 2, or at your preference, 11 | * any later version. 12 | */ 13 | 14 | #ifndef __DEVICE_H 15 | #define __DEVICE_H 16 | 17 | extern void clear_display(void); 18 | extern void power_key(void); 19 | extern void power_status(void); 20 | extern void power_display(void); 21 | extern void set_brightness(int brightness, int blen); 22 | extern void wait_sleep(void); 23 | extern void wait_wake(void); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /fbtruetype.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fbtruetype-android 3 | * 4 | * (c) 2015 by Michael Higham, 5 | * 6 | * This program is based on fbtruetype, written and (C) by 7 | * (c) 2001-2002 by Stefan Reinauer, 8 | * 9 | * This program my be redistributed under the terms of the 10 | * GNU General Public Licence, version 2, or at your preference, 11 | * any later version. 12 | */ 13 | 14 | #ifndef __FBTRUETYPE_H 15 | #define __FBTRUETYPE_H 16 | 17 | #define FBTRUETYPE_VERSION "0.41" 18 | 19 | #ifndef DEFAULT_FONTNAME 20 | #define DEFAULT_FONTNAME "/system/fonts/DroidSansMono.ttf" 21 | #endif 22 | 23 | extern volatile int run; 24 | extern int buffered; 25 | extern int dynpos; 26 | extern int waitsignal; 27 | extern int delta; 28 | extern int sconly; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | ## [0.41] - 2015-08-23 2 | ### Changed 3 | - Fixed font color bug. 4 | 5 | ## [0.40] - 2015-08-09 6 | ### Changed 7 | - New brightness option. 8 | - New simulate power key option. 9 | - Improved Zygote mode. 10 | - Cleaned up help screen and options. 11 | - Cleaned up the code. 12 | - More generic Samsung support added. 13 | 14 | ## [0.30] - 2015-08-03 15 | ### Changed 16 | - Basic line wrapping implemented (has bugs). 17 | - Basic word wrapping implemented (has bugs). 18 | - Added new option --boxwidth for line wrapping. 19 | - Changed default font to DroidSansMono. 20 | - Changed default font size. 21 | - Few error handling bug fixes. 22 | 23 | ## [0.20] - 2015-08-01 24 | ### Changed 25 | - Added Samsung support. 26 | 27 | ## [0.10] - 2015-04-10 28 | ### Changed 29 | - Initial program release. 30 | - Tested only on ARMv7l. 31 | -------------------------------------------------------------------------------- /ttf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fbtruetype-android 3 | * 4 | * (c) 2015 by Michael Higham, 5 | * 6 | * This program is based on fbtruetype, written and (C) by 7 | * (c) 2001-2002 by Stefan Reinauer, 8 | * 9 | * This program my be redistributed under the terms of the 10 | * GNU General Public Licence, version 2, or at your preference, 11 | * any later version. 12 | */ 13 | 14 | #define CACHED_METRICS 0x10 15 | #define CACHED_BITMAP 0x01 16 | #define CACHED_PIXMAP 0x02 17 | 18 | #define TTF_STYLE_NORMAL 0x00 19 | #define TTF_STYLE_BOLD 0x01 20 | #define TTF_STYLE_ITALIC 0x02 21 | #define TTF_STYLE_UNDERLINE 0x04 22 | 23 | /* Handy routines for converting from fixed point */ 24 | #define FT_FLOOR(X) ((X & -64) / 64) 25 | #define FT_CEIL(X) (((X + 63) & -64) / 64) 26 | 27 | typedef struct _TTF_Font TTF_Font; 28 | 29 | #define DROIDSANSMONO_SIZE 118640 30 | 31 | extern char DroidSansMono_ttf[DROIDSANSMONO_SIZE]; 32 | 33 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. 2 | # This Makefile.in is free software; the Free Software Foundation 3 | # gives unlimited permission to copy and/or distribute it, 4 | # with or without modifications, as long as this notice is preserved. 5 | 6 | # This program is distributed in the hope that it will be useful, 7 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 8 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 9 | # PARTICULAR PURPOSE. 10 | 11 | ARCH = arm 12 | SHELL = /bin/sh 13 | CC = arm-linux-gnueabi-gcc 14 | LIBDIR = ./libs 15 | 16 | PROGRAM = fbtruetype 17 | OBJECTS = fbtruetype.o functions.o messages.o device.o console.o ttf.o droidsansmono.o 18 | 19 | LDFLAGS += -L$(LIBDIR) 20 | LIBS = $(LIBDIR)/libfreetype.a $(LIBDIR)/libz.a -lm 21 | 22 | CFLAGS += -I./include/freetype2 23 | COMPILE = $(CC) $(CFLAGS) 24 | LINKS = $(CC) $(CFLAGS) $(LDFLAGS) -static -o $@ 25 | 26 | all: $(PROGRAM) 27 | 28 | clean: 29 | -rm -f fbtruetype *.o core 30 | 31 | fbtruetype: $(OBJECTS) 32 | @rm -f fbtruetype 33 | $(LINKS) $(LDFLAGS) $(OBJECTS) $(LIBS) 34 | -------------------------------------------------------------------------------- /console.c: -------------------------------------------------------------------------------- 1 | /* 2 | * fbtruetype-android 3 | * 4 | * (c) 2015 by Michael Higham, 5 | * 6 | * This program is based on fbtruetype, written and (C) by 7 | * (c) 2001-2002 by Stefan Reinauer, 8 | * 9 | * This program my be redistributed under the terms of the 10 | * GNU General Public Licence, version 2, or at your preference, 11 | * any later version. 12 | */ 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "console.h" 24 | 25 | int fd; 26 | 27 | int current_console(void) 28 | { 29 | int result=0; 30 | char twelve=12; 31 | 32 | result = ioctl(fd, TIOCLINUX, &twelve); 33 | 34 | return result; 35 | } 36 | 37 | void init_consoles(void) 38 | { 39 | 40 | /* Check for ADB virtual terminal */ 41 | fd=open("/dev/tty", O_RDWR|O_NDELAY); 42 | if (fd<0) { 43 | fd=open("/dev/tty0", O_RDWR|O_NDELAY); 44 | if (fd<0) { 45 | fprintf(stderr, "Could not open virtual terminal.\n"); 46 | exit (1); 47 | } 48 | } 49 | 50 | } 51 | 52 | 53 | -------------------------------------------------------------------------------- /include/freetype2/freetype/config/ftmodule.h: -------------------------------------------------------------------------------- 1 | /* This is a generated file. */ 2 | FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class ) 3 | FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class ) 4 | FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class ) 5 | FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class ) 6 | FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class ) 7 | FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class ) 8 | FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class ) 9 | FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class ) 10 | FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class ) 11 | FT_USE_MODULE( FT_Module_Class, sfnt_module_class ) 12 | FT_USE_MODULE( FT_Module_Class, autofit_module_class ) 13 | FT_USE_MODULE( FT_Module_Class, pshinter_module_class ) 14 | FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class ) 15 | FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class ) 16 | FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class ) 17 | FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class ) 18 | FT_USE_MODULE( FT_Module_Class, gxv_module_class ) 19 | FT_USE_MODULE( FT_Module_Class, otv_module_class ) 20 | FT_USE_MODULE( FT_Module_Class, psaux_module_class ) 21 | FT_USE_MODULE( FT_Module_Class, psnames_module_class ) 22 | /* EOF */ 23 | -------------------------------------------------------------------------------- /messages.c: -------------------------------------------------------------------------------- 1 | /* 2 | * fbtruetype-android 3 | * 4 | * (c) 2015 by Michael Higham, 5 | * 6 | * This program is based on fbtruetype, written and (C) by 7 | * (c) 2001-2002 by Stefan Reinauer, 8 | * 9 | * This program my be redistributed under the terms of the 10 | * GNU General Public Licence, version 2, or at your preference, 11 | * any later version. 12 | */ 13 | 14 | #include 15 | #include "fbtruetype.h" 16 | #include "messages.h" 17 | 18 | void usage(char *name) 19 | { 20 | fprintf(stderr, "FBTrueType v%s, Copyright (C) 2015, Michael Higham \n", FBTRUETYPE_VERSION); 21 | fprintf(stderr, "\nUsage: %s [OPTION] [TEXT]\n", name); 22 | fprintf(stderr, 23 | "\nOptions:\n\n" 24 | " -?, -h, --help: Print this help.\n" 25 | " -V, --version: Show version.\n" 26 | " -i, --info: Print device display information.\n\n" 27 | "" 28 | " -z, --zygote: Zygote mode.\n" 29 | " -p, --power: Send power key event.\n" 30 | " -c, --clear Clear the device display.\n\n" 31 | "" 32 | " -x: X coordinate pixel [default 10]\n" 33 | " -y: Y coordinate pixel [default 10]\n" 34 | " -b, --brightness: Set display brightness [0-255] [default 170]\n" 35 | " -w, --boxwidth: Text box column size [default 65]\n" 36 | " -f, --font: Font name [.ttf file]\n" 37 | " -s, --size: Font size [default 12]\n" 38 | " -t, --textcolor: Font color [RGB Hex: FFFFFF]\n" 39 | " -a, --alpha: Alpha channel [1-100]\n\n"); 40 | } 41 | 42 | void version(void) 43 | { 44 | fprintf(stderr, 45 | "fbtruetype v%s, Copyright (C) 2015, Michael Higham \n\n" 46 | "fbtruetype comes with ABSOLUTELY NO WARRANTY;\n" 47 | "This is free software, and you are welcome to redistribute it\n" 48 | "under certain conditions; Check the GPL for details.\n", FBTRUETYPE_VERSION); 49 | } 50 | -------------------------------------------------------------------------------- /include/freetype2/freetype/ttunpat.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ttunpat.h */ 4 | /* */ 5 | /* Definitions for the unpatented TrueType hinting system */ 6 | /* */ 7 | /* Copyright 2003, 2006 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* Written by Graham Asher */ 11 | /* */ 12 | /* This file is part of the FreeType project, and may only be used, */ 13 | /* modified, and distributed under the terms of the FreeType project */ 14 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 15 | /* this file you indicate that you have read the license and */ 16 | /* understand and accept it fully. */ 17 | /* */ 18 | /***************************************************************************/ 19 | 20 | 21 | #ifndef __TTUNPAT_H__ 22 | #define __TTUNPAT_H__ 23 | 24 | 25 | #include 26 | #include FT_FREETYPE_H 27 | 28 | #ifdef FREETYPE_H 29 | #error "freetype.h of FreeType 1 has been loaded!" 30 | #error "Please fix the directory search order for header files" 31 | #error "so that freetype.h of FreeType 2 is found first." 32 | #endif 33 | 34 | 35 | FT_BEGIN_HEADER 36 | 37 | 38 | /*************************************************************************** 39 | * 40 | * @constant: 41 | * FT_PARAM_TAG_UNPATENTED_HINTING 42 | * 43 | * @description: 44 | * A constant used as the tag of an @FT_Parameter structure to indicate 45 | * that unpatented methods only should be used by the TrueType bytecode 46 | * interpreter for a typeface opened by @FT_Open_Face. 47 | * 48 | */ 49 | #define FT_PARAM_TAG_UNPATENTED_HINTING FT_MAKE_TAG( 'u', 'n', 'p', 'a' ) 50 | 51 | /* */ 52 | 53 | FT_END_HEADER 54 | 55 | 56 | #endif /* __TTUNPAT_H__ */ 57 | 58 | 59 | /* END */ 60 | -------------------------------------------------------------------------------- /functions.c: -------------------------------------------------------------------------------- 1 | /* 2 | * fbtruetype-android 3 | * 4 | * (c) 2015 by Michael Higham, 5 | * 6 | * This program is based on fbtruetype, written and (C) by 7 | * (c) 2001-2002 by Stefan Reinauer, 8 | * 9 | * This program my be redistributed under the terms of the 10 | * GNU General Public Licence, version 2, or at your preference, 11 | * any later version. 12 | */ 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #include "functions.h" 22 | 23 | int strwrap(char * s, int w, char *** line_ret, int ** len_ret) 24 | { 25 | int allocated; /* lines allocated */ 26 | int lines; /* lines used */ 27 | char ** line; 28 | int * len; 29 | int tl; /* total length of the string */ 30 | int l; /* length of current line */ 31 | int p; /* offset (from s) of current line */ 32 | int close_word; 33 | int open_word; 34 | int i; 35 | 36 | if (s == NULL) 37 | return 0; 38 | 39 | tl = strlen(s); 40 | if (tl == 0 || w <= 0) 41 | return 0; 42 | 43 | lines = 0; 44 | allocated = (tl / w) * 1.5 + 1; 45 | line = (char **) malloc(sizeof(char *) * allocated); 46 | len = (int *) malloc(sizeof(int) * allocated); 47 | 48 | if (line == NULL || len == NULL) 49 | return 0; 50 | 51 | p = 0; 52 | while (p < tl) 53 | { 54 | if (s[p] == '\n') 55 | { 56 | l = 0; 57 | goto make_new_line; 58 | } 59 | 60 | if (p + w > tl) 61 | w = tl - p; 62 | l = w; 63 | close_word = 0; 64 | 65 | while (s[p + l + close_word] != '\0' && !isspace(s[p + l + close_word])) 66 | close_word++; 67 | 68 | while (s[p + l] != '\0' && !isspace(s[p + l])) 69 | { 70 | l--; 71 | open_word ++; 72 | 73 | if (open_word + close_word > w * 0.8) 74 | { 75 | l = w; 76 | break; 77 | } 78 | } 79 | 80 | for (i = 0; i < l; i++) 81 | { 82 | if (s[p + i] == '\n') 83 | { 84 | l = i; 85 | break; 86 | } 87 | } 88 | 89 | make_new_line: 90 | line[lines] = &s[p]; 91 | len[lines] = l; 92 | lines++; 93 | 94 | if (lines >= allocated) 95 | { 96 | allocated *= 2; 97 | line = (char **) realloc(line, sizeof(char *) * allocated); 98 | len = (int *) realloc(len, sizeof(int) * allocated); 99 | 100 | if (line == NULL || len == NULL) 101 | return 0; 102 | } 103 | 104 | if (l == w) 105 | l--; 106 | 107 | p += l + 1; 108 | } 109 | 110 | line = (char **) realloc(line, sizeof(char *) * lines); 111 | len = (int *) realloc(len, sizeof(int) * lines); 112 | 113 | *line_ret = line; 114 | *len_ret = len; 115 | 116 | return lines; 117 | } 118 | -------------------------------------------------------------------------------- /test/devinfo.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | 3 | ######################################### 4 | # Dev info test script 5 | #---------------------------------------- 6 | # by Michael Higham 7 | # 8 | #---------------------------------------- 9 | # Very quickly written simple script to 10 | # show basic device information using 11 | # getprop as follows: 12 | # 13 | # Manufacturer: 14 | # Model: 15 | # SIM Operator: 16 | # IP Address: 17 | # Serial No: 18 | # Board: 19 | # BT Name: 20 | # 21 | ######################################### 22 | 23 | 24 | ######################################### 25 | # FBTrueType location 26 | ######################################### 27 | fbtruetype=/system/xbin/fbtruetype 28 | 29 | 30 | ######################################### 31 | # Font style + Box size 32 | ######################################### 33 | font=/system/fonts/DroidSans.ttf 34 | font_size=18 35 | boxwidth=80 36 | 37 | 38 | ######################################### 39 | # Set the y offset to begin from 40 | # Set the character to print 41 | ######################################### 42 | ypos=10 43 | 44 | $fbtruetype -y $ypos -w $boxwidth -f $font -s $font_size "Manufacturer:" 45 | ypos=$(($ypos+$font_size)) 46 | $fbtruetype -y $ypos -w $boxwidth -f $font -s $font_size -t 00FF00 "$(getprop ro.product.manufacturer)" 47 | ypos=$(($ypos+$font_size)) 48 | $fbtruetype -y $ypos -w $boxwidth -f $font -s $font_size " " 49 | ypos=$(($ypos+$font_size)) 50 | $fbtruetype -y $ypos -w $boxwidth -f $font -s $font_size "Model:" 51 | ypos=$(($ypos+$font_size)) 52 | $fbtruetype -y $ypos -w $boxwidth -f $font -s $font_size -t 00FF00 "$(getprop ro.product.name)" 53 | ypos=$(($ypos+$font_size)) 54 | $fbtruetype -y $ypos -w $boxwidth -f $font -s $font_size " " 55 | ypos=$(($ypos+$font_size)) 56 | $fbtruetype -y $ypos -w $boxwidth -f $font -s $font_size "SIM Operator:" 57 | ypos=$(($ypos+$font_size)) 58 | $fbtruetype -y $ypos -w $boxwidth -f $font -s $font_size -t 00FF00 "$(getprop gsm.sim.operator.alpha)" 59 | ypos=$(($ypos+$font_size)) 60 | $fbtruetype -y $ypos -w $boxwidth -f $font -s $font_size " " 61 | ypos=$(($ypos+$font_size)) 62 | $fbtruetype -y $ypos -w $boxwidth -f $font -s $font_size "IP Address:" 63 | ypos=$(($ypos+$font_size)) 64 | $fbtruetype -y $ypos -w $boxwidth -f $font -s $font_size -t 00FF00 "$(getprop dhcp.eth0.ipaddress)" 65 | ypos=$(($ypos+$font_size)) 66 | $fbtruetype -y $ypos -w $boxwidth -f $font -s $font_size " " 67 | ypos=$(($ypos+$font_size)) 68 | $fbtruetype -y $ypos -w $boxwidth -f $font -s $font_size "Serial No:" 69 | ypos=$(($ypos+$font_size)) 70 | $fbtruetype -y $ypos -w $boxwidth -f $font -s $font_size -t 00FF00 "$(getprop ro.serialno)" 71 | ypos=$(($ypos+$font_size)) 72 | $fbtruetype -y $ypos -w $boxwidth -f $font -s $font_size " " 73 | ypos=$(($ypos+$font_size)) 74 | $fbtruetype -y $ypos -w $boxwidth -f $font -s $font_size "Board:" 75 | ypos=$(($ypos+$font_size)) 76 | $fbtruetype -y $ypos -w $boxwidth -f $font -s $font_size -t 00FF00 "$(getprop ro.board.platform)" 77 | ypos=$(($ypos+$font_size)) 78 | $fbtruetype -y $ypos -w $boxwidth -f $font -s $font_size " " 79 | ypos=$(($ypos+$font_size)) 80 | $fbtruetype -y $ypos -w $boxwidth -f $font -s $font_size "BT Name:" 81 | ypos=$(($ypos+$font_size)) 82 | $fbtruetype -y $ypos -w $boxwidth -f $font -s $font_size -t 00FF00 "$(getprop net.bt.name)" 83 | 84 | exit 85 | -------------------------------------------------------------------------------- /include/ft2build.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ft2build.h */ 4 | /* */ 5 | /* Build macros of the FreeType 2 library. */ 6 | /* */ 7 | /* Copyright 1996-2001, 2003, 2006 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 | /*************************************************************************/ 20 | /* */ 21 | /* This is a Unix-specific version of that should be used */ 22 | /* exclusively *after* installation of the library. */ 23 | /* */ 24 | /* It assumes that `/usr/local/include/freetype2' (or whatever is */ 25 | /* returned by the `freetype-config --cflags' or `pkg-config --cflags' */ 26 | /* command) is in your compilation include path. */ 27 | /* */ 28 | /* We don't need to do anything special in this release. However, for */ 29 | /* a future FreeType 2 release, the following installation changes will */ 30 | /* be performed: */ 31 | /* */ 32 | /* - The contents of `freetype-2.x/include/freetype' will be installed */ 33 | /* to `/usr/local/include/freetype2' instead of */ 34 | /* `/usr/local/include/freetype2/freetype'. */ 35 | /* */ 36 | /* - This file will #include , instead */ 37 | /* of . */ 38 | /* */ 39 | /* - The contents of `ftheader.h' will be processed with `sed' to */ 40 | /* replace all `' with `'. */ 41 | /* */ 42 | /* - Adding `/usr/local/include/freetype2' to your compilation include */ 43 | /* path will not be necessary anymore. */ 44 | /* */ 45 | /* These changes will be transparent to client applications which use */ 46 | /* freetype-config (or pkg-config). No modifications will be necessary */ 47 | /* to compile with the new scheme. */ 48 | /* */ 49 | /*************************************************************************/ 50 | 51 | 52 | #ifndef __FT2_BUILD_UNIX_H__ 53 | #define __FT2_BUILD_UNIX_H__ 54 | 55 | /* `/include/freetype2' must be in your current inclusion path */ 56 | #include 57 | 58 | #endif /* __FT2_BUILD_UNIX_H__ */ 59 | 60 | 61 | /* END */ 62 | -------------------------------------------------------------------------------- /include/freetype2/freetype/ftsynth.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftsynth.h */ 4 | /* */ 5 | /* FreeType synthesizing code for emboldening and slanting */ 6 | /* (specification). */ 7 | /* */ 8 | /* Copyright 2000-2001, 2003, 2006, 2008 by */ 9 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 10 | /* */ 11 | /* This file is part of the FreeType project, and may only be used, */ 12 | /* modified, and distributed under the terms of the FreeType project */ 13 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 14 | /* this file you indicate that you have read the license and */ 15 | /* understand and accept it fully. */ 16 | /* */ 17 | /***************************************************************************/ 18 | 19 | 20 | /*************************************************************************/ 21 | /*************************************************************************/ 22 | /*************************************************************************/ 23 | /*************************************************************************/ 24 | /*************************************************************************/ 25 | /********* *********/ 26 | /********* WARNING, THIS IS ALPHA CODE! THIS API *********/ 27 | /********* IS DUE TO CHANGE UNTIL STRICTLY NOTIFIED BY THE *********/ 28 | /********* FREETYPE DEVELOPMENT TEAM *********/ 29 | /********* *********/ 30 | /*************************************************************************/ 31 | /*************************************************************************/ 32 | /*************************************************************************/ 33 | /*************************************************************************/ 34 | /*************************************************************************/ 35 | 36 | 37 | /* Main reason for not lifting the functions in this module to a */ 38 | /* `standard' API is that the used parameters for emboldening and */ 39 | /* slanting are not configurable. Consider the functions as a */ 40 | /* code resource which should be copied into the application and */ 41 | /* adapted to the particular needs. */ 42 | 43 | 44 | #ifndef __FTSYNTH_H__ 45 | #define __FTSYNTH_H__ 46 | 47 | 48 | #include 49 | #include FT_FREETYPE_H 50 | 51 | #ifdef FREETYPE_H 52 | #error "freetype.h of FreeType 1 has been loaded!" 53 | #error "Please fix the directory search order for header files" 54 | #error "so that freetype.h of FreeType 2 is found first." 55 | #endif 56 | 57 | 58 | FT_BEGIN_HEADER 59 | 60 | /* Embolden a glyph by a `reasonable' value (which is highly a matter of */ 61 | /* taste). This function is actually a convenience function, providing */ 62 | /* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden. */ 63 | /* */ 64 | /* For emboldened outlines the metrics are estimates only; if you need */ 65 | /* precise values you should call @FT_Outline_Get_CBox. */ 66 | FT_EXPORT( void ) 67 | FT_GlyphSlot_Embolden( FT_GlyphSlot slot ); 68 | 69 | /* Slant an outline glyph to the right by about 12 degrees. */ 70 | FT_EXPORT( void ) 71 | FT_GlyphSlot_Oblique( FT_GlyphSlot slot ); 72 | 73 | /* */ 74 | 75 | FT_END_HEADER 76 | 77 | #endif /* __FTSYNTH_H__ */ 78 | 79 | 80 | /* END */ 81 | -------------------------------------------------------------------------------- /include/freetype2/freetype/ftlzw.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftlzw.h */ 4 | /* */ 5 | /* LZW-compressed stream support. */ 6 | /* */ 7 | /* Copyright 2004, 2006 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 __FTLZW_H__ 20 | #define __FTLZW_H__ 21 | 22 | #include 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | /*************************************************************************/ 35 | /* */ 36 | /*
*/ 37 | /* lzw */ 38 | /* */ 39 | /* */ 40 | /* LZW Streams */ 41 | /* */ 42 | /* <Abstract> */ 43 | /* Using LZW-compressed font files. */ 44 | /* */ 45 | /* <Description> */ 46 | /* This section contains the declaration of LZW-specific functions. */ 47 | /* */ 48 | /*************************************************************************/ 49 | 50 | /************************************************************************ 51 | * 52 | * @function: 53 | * FT_Stream_OpenLZW 54 | * 55 | * @description: 56 | * Open a new stream to parse LZW-compressed font files. This is 57 | * mainly used to support the compressed `*.pcf.Z' fonts that come 58 | * with XFree86. 59 | * 60 | * @input: 61 | * stream :: The target embedding stream. 62 | * 63 | * source :: The source stream. 64 | * 65 | * @return: 66 | * FreeType error code. 0~means success. 67 | * 68 | * @note: 69 | * The source stream must be opened _before_ calling this function. 70 | * 71 | * Calling the internal function `FT_Stream_Close' on the new stream will 72 | * *not* call `FT_Stream_Close' on the source stream. None of the stream 73 | * objects will be released to the heap. 74 | * 75 | * The stream implementation is very basic and resets the decompression 76 | * process each time seeking backwards is needed within the stream 77 | * 78 | * In certain builds of the library, LZW compression recognition is 79 | * automatically handled when calling @FT_New_Face or @FT_Open_Face. 80 | * This means that if no font driver is capable of handling the raw 81 | * compressed file, the library will try to open a LZW stream from it 82 | * and re-open the face with it. 83 | * 84 | * This function may return `FT_Err_Unimplemented_Feature' if your build 85 | * of FreeType was not compiled with LZW support. 86 | */ 87 | FT_EXPORT( FT_Error ) 88 | FT_Stream_OpenLZW( FT_Stream stream, 89 | FT_Stream source ); 90 | 91 | /* */ 92 | 93 | 94 | FT_END_HEADER 95 | 96 | #endif /* __FTLZW_H__ */ 97 | 98 | 99 | /* END */ 100 | -------------------------------------------------------------------------------- /include/freetype2/freetype/ftgzip.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftgzip.h */ 4 | /* */ 5 | /* Gzip-compressed stream support. */ 6 | /* */ 7 | /* Copyright 2002, 2003, 2004, 2006 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 __FTGZIP_H__ 20 | #define __FTGZIP_H__ 21 | 22 | #include <ft2build.h> 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | /*************************************************************************/ 35 | /* */ 36 | /* <Section> */ 37 | /* gzip */ 38 | /* */ 39 | /* <Title> */ 40 | /* GZIP Streams */ 41 | /* */ 42 | /* <Abstract> */ 43 | /* Using gzip-compressed font files. */ 44 | /* */ 45 | /* <Description> */ 46 | /* This section contains the declaration of Gzip-specific functions. */ 47 | /* */ 48 | /*************************************************************************/ 49 | 50 | 51 | /************************************************************************ 52 | * 53 | * @function: 54 | * FT_Stream_OpenGzip 55 | * 56 | * @description: 57 | * Open a new stream to parse gzip-compressed font files. This is 58 | * mainly used to support the compressed `*.pcf.gz' fonts that come 59 | * with XFree86. 60 | * 61 | * @input: 62 | * stream :: 63 | * The target embedding stream. 64 | * 65 | * source :: 66 | * The source stream. 67 | * 68 | * @return: 69 | * FreeType error code. 0~means success. 70 | * 71 | * @note: 72 | * The source stream must be opened _before_ calling this function. 73 | * 74 | * Calling the internal function `FT_Stream_Close' on the new stream will 75 | * *not* call `FT_Stream_Close' on the source stream. None of the stream 76 | * objects will be released to the heap. 77 | * 78 | * The stream implementation is very basic and resets the decompression 79 | * process each time seeking backwards is needed within the stream. 80 | * 81 | * In certain builds of the library, gzip compression recognition is 82 | * automatically handled when calling @FT_New_Face or @FT_Open_Face. 83 | * This means that if no font driver is capable of handling the raw 84 | * compressed file, the library will try to open a gzipped stream from 85 | * it and re-open the face with it. 86 | * 87 | * This function may return `FT_Err_Unimplemented_Feature' if your build 88 | * of FreeType was not compiled with zlib support. 89 | */ 90 | FT_EXPORT( FT_Error ) 91 | FT_Stream_OpenGzip( FT_Stream stream, 92 | FT_Stream source ); 93 | 94 | /* */ 95 | 96 | 97 | FT_END_HEADER 98 | 99 | #endif /* __FTGZIP_H__ */ 100 | 101 | 102 | /* END */ 103 | -------------------------------------------------------------------------------- /include/freetype2/freetype/ftbzip2.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftbzip2.h */ 4 | /* */ 5 | /* Bzip2-compressed stream support. */ 6 | /* */ 7 | /* Copyright 2010 by */ 8 | /* Joel Klinghed. */ 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 __FTBZIP2_H__ 20 | #define __FTBZIP2_H__ 21 | 22 | #include <ft2build.h> 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | /*************************************************************************/ 35 | /* */ 36 | /* <Section> */ 37 | /* bzip2 */ 38 | /* */ 39 | /* <Title> */ 40 | /* BZIP2 Streams */ 41 | /* */ 42 | /* <Abstract> */ 43 | /* Using bzip2-compressed font files. */ 44 | /* */ 45 | /* <Description> */ 46 | /* This section contains the declaration of Bzip2-specific functions. */ 47 | /* */ 48 | /*************************************************************************/ 49 | 50 | 51 | /************************************************************************ 52 | * 53 | * @function: 54 | * FT_Stream_OpenBzip2 55 | * 56 | * @description: 57 | * Open a new stream to parse bzip2-compressed font files. This is 58 | * mainly used to support the compressed `*.pcf.bz2' fonts that come 59 | * with XFree86. 60 | * 61 | * @input: 62 | * stream :: 63 | * The target embedding stream. 64 | * 65 | * source :: 66 | * The source stream. 67 | * 68 | * @return: 69 | * FreeType error code. 0~means success. 70 | * 71 | * @note: 72 | * The source stream must be opened _before_ calling this function. 73 | * 74 | * Calling the internal function `FT_Stream_Close' on the new stream will 75 | * *not* call `FT_Stream_Close' on the source stream. None of the stream 76 | * objects will be released to the heap. 77 | * 78 | * The stream implementation is very basic and resets the decompression 79 | * process each time seeking backwards is needed within the stream. 80 | * 81 | * In certain builds of the library, bzip2 compression recognition is 82 | * automatically handled when calling @FT_New_Face or @FT_Open_Face. 83 | * This means that if no font driver is capable of handling the raw 84 | * compressed file, the library will try to open a bzip2 compressed stream 85 | * from it and re-open the face with it. 86 | * 87 | * This function may return `FT_Err_Unimplemented_Feature' if your build 88 | * of FreeType was not compiled with bzip2 support. 89 | */ 90 | FT_EXPORT( FT_Error ) 91 | FT_Stream_OpenBzip2( FT_Stream stream, 92 | FT_Stream source ); 93 | 94 | /* */ 95 | 96 | 97 | FT_END_HEADER 98 | 99 | #endif /* __FTBZIP2_H__ */ 100 | 101 | 102 | /* END */ 103 | -------------------------------------------------------------------------------- /include/freetype2/freetype/ftxf86.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftxf86.h */ 4 | /* */ 5 | /* Support functions for X11. */ 6 | /* */ 7 | /* Copyright 2002, 2003, 2004, 2006, 2007 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 __FTXF86_H__ 20 | #define __FTXF86_H__ 21 | 22 | #include <ft2build.h> 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | 35 | /*************************************************************************/ 36 | /* */ 37 | /* <Section> */ 38 | /* font_formats */ 39 | /* */ 40 | /* <Title> */ 41 | /* Font Formats */ 42 | /* */ 43 | /* <Abstract> */ 44 | /* Getting the font format. */ 45 | /* */ 46 | /* <Description> */ 47 | /* The single function in this section can be used to get the font */ 48 | /* format. Note that this information is not needed normally; */ 49 | /* however, there are special cases (like in PDF devices) where it is */ 50 | /* important to differentiate, in spite of FreeType's uniform API. */ 51 | /* */ 52 | /* This function is in the X11/xf86 namespace for historical reasons */ 53 | /* and in no way depends on that windowing system. */ 54 | /* */ 55 | /*************************************************************************/ 56 | 57 | 58 | /*************************************************************************/ 59 | /* */ 60 | /* <Function> */ 61 | /* FT_Get_X11_Font_Format */ 62 | /* */ 63 | /* <Description> */ 64 | /* Return a string describing the format of a given face, using values */ 65 | /* which can be used as an X11 FONT_PROPERTY. Possible values are */ 66 | /* `TrueType', `Type~1', `BDF', `PCF', `Type~42', `CID~Type~1', `CFF', */ 67 | /* `PFR', and `Windows~FNT'. */ 68 | /* */ 69 | /* <Input> */ 70 | /* face :: */ 71 | /* Input face handle. */ 72 | /* */ 73 | /* <Return> */ 74 | /* Font format string. NULL in case of error. */ 75 | /* */ 76 | FT_EXPORT( const char* ) 77 | FT_Get_X11_Font_Format( FT_Face face ); 78 | 79 | /* */ 80 | 81 | FT_END_HEADER 82 | 83 | #endif /* __FTXF86_H__ */ 84 | -------------------------------------------------------------------------------- /include/freetype2/freetype/ftgasp.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftgasp.h */ 4 | /* */ 5 | /* Access of TrueType's `gasp' table (specification). */ 6 | /* */ 7 | /* Copyright 2007, 2008, 2011 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 _FT_GASP_H_ 20 | #define _FT_GASP_H_ 21 | 22 | #include <ft2build.h> 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | /*************************************************************************** 33 | * 34 | * @section: 35 | * gasp_table 36 | * 37 | * @title: 38 | * Gasp Table 39 | * 40 | * @abstract: 41 | * Retrieving TrueType `gasp' table entries. 42 | * 43 | * @description: 44 | * The function @FT_Get_Gasp can be used to query a TrueType or OpenType 45 | * font for specific entries in its `gasp' table, if any. This is 46 | * mainly useful when implementing native TrueType hinting with the 47 | * bytecode interpreter to duplicate the Windows text rendering results. 48 | */ 49 | 50 | /************************************************************************* 51 | * 52 | * @enum: 53 | * FT_GASP_XXX 54 | * 55 | * @description: 56 | * A list of values and/or bit-flags returned by the @FT_Get_Gasp 57 | * function. 58 | * 59 | * @values: 60 | * FT_GASP_NO_TABLE :: 61 | * This special value means that there is no GASP table in this face. 62 | * It is up to the client to decide what to do. 63 | * 64 | * FT_GASP_DO_GRIDFIT :: 65 | * Grid-fitting and hinting should be performed at the specified ppem. 66 | * This *really* means TrueType bytecode interpretation. If this bit 67 | * is not set, no hinting gets applied. 68 | * 69 | * FT_GASP_DO_GRAY :: 70 | * Anti-aliased rendering should be performed at the specified ppem. 71 | * If not set, do monochrome rendering. 72 | * 73 | * FT_GASP_SYMMETRIC_SMOOTHING :: 74 | * If set, smoothing along multiple axes must be used with ClearType. 75 | * 76 | * FT_GASP_SYMMETRIC_GRIDFIT :: 77 | * Grid-fitting must be used with ClearType's symmetric smoothing. 78 | * 79 | * @note: 80 | * The bit-flags `FT_GASP_DO_GRIDFIT' and `FT_GASP_DO_GRAY' are to be 81 | * used for standard font rasterization only. Independently of that, 82 | * `FT_GASP_SYMMETRIC_SMOOTHING' and `FT_GASP_SYMMETRIC_GRIDFIT' are to 83 | * be used if ClearType is enabled (and `FT_GASP_DO_GRIDFIT' and 84 | * `FT_GASP_DO_GRAY' are consequently ignored). 85 | * 86 | * `ClearType' is Microsoft's implementation of LCD rendering, partly 87 | * protected by patents. 88 | * 89 | * @since: 90 | * 2.3.0 91 | */ 92 | #define FT_GASP_NO_TABLE -1 93 | #define FT_GASP_DO_GRIDFIT 0x01 94 | #define FT_GASP_DO_GRAY 0x02 95 | #define FT_GASP_SYMMETRIC_SMOOTHING 0x08 96 | #define FT_GASP_SYMMETRIC_GRIDFIT 0x10 97 | 98 | 99 | /************************************************************************* 100 | * 101 | * @func: 102 | * FT_Get_Gasp 103 | * 104 | * @description: 105 | * Read the `gasp' table from a TrueType or OpenType font file and 106 | * return the entry corresponding to a given character pixel size. 107 | * 108 | * @input: 109 | * face :: The source face handle. 110 | * ppem :: The vertical character pixel size. 111 | * 112 | * @return: 113 | * Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no 114 | * `gasp' table in the face. 115 | * 116 | * @since: 117 | * 2.3.0 118 | */ 119 | FT_EXPORT( FT_Int ) 120 | FT_Get_Gasp( FT_Face face, 121 | FT_UInt ppem ); 122 | 123 | /* */ 124 | 125 | #endif /* _FT_GASP_H_ */ 126 | 127 | 128 | /* END */ 129 | -------------------------------------------------------------------------------- /include/freetype2/freetype/tttags.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* tttags.h */ 4 | /* */ 5 | /* Tags for TrueType and OpenType tables (specification only). */ 6 | /* */ 7 | /* Copyright 1996-2001, 2004, 2005, 2007, 2008 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 __TTAGS_H__ 20 | #define __TTAGS_H__ 21 | 22 | 23 | #include <ft2build.h> 24 | #include FT_FREETYPE_H 25 | 26 | #ifdef FREETYPE_H 27 | #error "freetype.h of FreeType 1 has been loaded!" 28 | #error "Please fix the directory search order for header files" 29 | #error "so that freetype.h of FreeType 2 is found first." 30 | #endif 31 | 32 | 33 | FT_BEGIN_HEADER 34 | 35 | 36 | #define TTAG_avar FT_MAKE_TAG( 'a', 'v', 'a', 'r' ) 37 | #define TTAG_BASE FT_MAKE_TAG( 'B', 'A', 'S', 'E' ) 38 | #define TTAG_bdat FT_MAKE_TAG( 'b', 'd', 'a', 't' ) 39 | #define TTAG_BDF FT_MAKE_TAG( 'B', 'D', 'F', ' ' ) 40 | #define TTAG_bhed FT_MAKE_TAG( 'b', 'h', 'e', 'd' ) 41 | #define TTAG_bloc FT_MAKE_TAG( 'b', 'l', 'o', 'c' ) 42 | #define TTAG_bsln FT_MAKE_TAG( 'b', 's', 'l', 'n' ) 43 | #define TTAG_CFF FT_MAKE_TAG( 'C', 'F', 'F', ' ' ) 44 | #define TTAG_CID FT_MAKE_TAG( 'C', 'I', 'D', ' ' ) 45 | #define TTAG_cmap FT_MAKE_TAG( 'c', 'm', 'a', 'p' ) 46 | #define TTAG_cvar FT_MAKE_TAG( 'c', 'v', 'a', 'r' ) 47 | #define TTAG_cvt FT_MAKE_TAG( 'c', 'v', 't', ' ' ) 48 | #define TTAG_DSIG FT_MAKE_TAG( 'D', 'S', 'I', 'G' ) 49 | #define TTAG_EBDT FT_MAKE_TAG( 'E', 'B', 'D', 'T' ) 50 | #define TTAG_EBLC FT_MAKE_TAG( 'E', 'B', 'L', 'C' ) 51 | #define TTAG_EBSC FT_MAKE_TAG( 'E', 'B', 'S', 'C' ) 52 | #define TTAG_feat FT_MAKE_TAG( 'f', 'e', 'a', 't' ) 53 | #define TTAG_FOND FT_MAKE_TAG( 'F', 'O', 'N', 'D' ) 54 | #define TTAG_fpgm FT_MAKE_TAG( 'f', 'p', 'g', 'm' ) 55 | #define TTAG_fvar FT_MAKE_TAG( 'f', 'v', 'a', 'r' ) 56 | #define TTAG_gasp FT_MAKE_TAG( 'g', 'a', 's', 'p' ) 57 | #define TTAG_GDEF FT_MAKE_TAG( 'G', 'D', 'E', 'F' ) 58 | #define TTAG_glyf FT_MAKE_TAG( 'g', 'l', 'y', 'f' ) 59 | #define TTAG_GPOS FT_MAKE_TAG( 'G', 'P', 'O', 'S' ) 60 | #define TTAG_GSUB FT_MAKE_TAG( 'G', 'S', 'U', 'B' ) 61 | #define TTAG_gvar FT_MAKE_TAG( 'g', 'v', 'a', 'r' ) 62 | #define TTAG_hdmx FT_MAKE_TAG( 'h', 'd', 'm', 'x' ) 63 | #define TTAG_head FT_MAKE_TAG( 'h', 'e', 'a', 'd' ) 64 | #define TTAG_hhea FT_MAKE_TAG( 'h', 'h', 'e', 'a' ) 65 | #define TTAG_hmtx FT_MAKE_TAG( 'h', 'm', 't', 'x' ) 66 | #define TTAG_JSTF FT_MAKE_TAG( 'J', 'S', 'T', 'F' ) 67 | #define TTAG_just FT_MAKE_TAG( 'j', 'u', 's', 't' ) 68 | #define TTAG_kern FT_MAKE_TAG( 'k', 'e', 'r', 'n' ) 69 | #define TTAG_lcar FT_MAKE_TAG( 'l', 'c', 'a', 'r' ) 70 | #define TTAG_loca FT_MAKE_TAG( 'l', 'o', 'c', 'a' ) 71 | #define TTAG_LTSH FT_MAKE_TAG( 'L', 'T', 'S', 'H' ) 72 | #define TTAG_LWFN FT_MAKE_TAG( 'L', 'W', 'F', 'N' ) 73 | #define TTAG_MATH FT_MAKE_TAG( 'M', 'A', 'T', 'H' ) 74 | #define TTAG_maxp FT_MAKE_TAG( 'm', 'a', 'x', 'p' ) 75 | #define TTAG_META FT_MAKE_TAG( 'M', 'E', 'T', 'A' ) 76 | #define TTAG_MMFX FT_MAKE_TAG( 'M', 'M', 'F', 'X' ) 77 | #define TTAG_MMSD FT_MAKE_TAG( 'M', 'M', 'S', 'D' ) 78 | #define TTAG_mort FT_MAKE_TAG( 'm', 'o', 'r', 't' ) 79 | #define TTAG_morx FT_MAKE_TAG( 'm', 'o', 'r', 'x' ) 80 | #define TTAG_name FT_MAKE_TAG( 'n', 'a', 'm', 'e' ) 81 | #define TTAG_opbd FT_MAKE_TAG( 'o', 'p', 'b', 'd' ) 82 | #define TTAG_OS2 FT_MAKE_TAG( 'O', 'S', '/', '2' ) 83 | #define TTAG_OTTO FT_MAKE_TAG( 'O', 'T', 'T', 'O' ) 84 | #define TTAG_PCLT FT_MAKE_TAG( 'P', 'C', 'L', 'T' ) 85 | #define TTAG_POST FT_MAKE_TAG( 'P', 'O', 'S', 'T' ) 86 | #define TTAG_post FT_MAKE_TAG( 'p', 'o', 's', 't' ) 87 | #define TTAG_prep FT_MAKE_TAG( 'p', 'r', 'e', 'p' ) 88 | #define TTAG_prop FT_MAKE_TAG( 'p', 'r', 'o', 'p' ) 89 | #define TTAG_sfnt FT_MAKE_TAG( 's', 'f', 'n', 't' ) 90 | #define TTAG_SING FT_MAKE_TAG( 'S', 'I', 'N', 'G' ) 91 | #define TTAG_trak FT_MAKE_TAG( 't', 'r', 'a', 'k' ) 92 | #define TTAG_true FT_MAKE_TAG( 't', 'r', 'u', 'e' ) 93 | #define TTAG_ttc FT_MAKE_TAG( 't', 't', 'c', ' ' ) 94 | #define TTAG_ttcf FT_MAKE_TAG( 't', 't', 'c', 'f' ) 95 | #define TTAG_TYP1 FT_MAKE_TAG( 'T', 'Y', 'P', '1' ) 96 | #define TTAG_typ1 FT_MAKE_TAG( 't', 'y', 'p', '1' ) 97 | #define TTAG_VDMX FT_MAKE_TAG( 'V', 'D', 'M', 'X' ) 98 | #define TTAG_vhea FT_MAKE_TAG( 'v', 'h', 'e', 'a' ) 99 | #define TTAG_vmtx FT_MAKE_TAG( 'v', 'm', 't', 'x' ) 100 | 101 | 102 | FT_END_HEADER 103 | 104 | #endif /* __TTAGS_H__ */ 105 | 106 | 107 | /* END */ 108 | -------------------------------------------------------------------------------- /include/freetype2/freetype/ftbbox.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftbbox.h */ 4 | /* */ 5 | /* FreeType exact bbox computation (specification). */ 6 | /* */ 7 | /* Copyright 1996-2001, 2003, 2007, 2011 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 | /*************************************************************************/ 20 | /* */ 21 | /* This component has a _single_ role: to compute exact outline bounding */ 22 | /* boxes. */ 23 | /* */ 24 | /* It is separated from the rest of the engine for various technical */ 25 | /* reasons. It may well be integrated in `ftoutln' later. */ 26 | /* */ 27 | /*************************************************************************/ 28 | 29 | 30 | #ifndef __FTBBOX_H__ 31 | #define __FTBBOX_H__ 32 | 33 | 34 | #include <ft2build.h> 35 | #include FT_FREETYPE_H 36 | 37 | #ifdef FREETYPE_H 38 | #error "freetype.h of FreeType 1 has been loaded!" 39 | #error "Please fix the directory search order for header files" 40 | #error "so that freetype.h of FreeType 2 is found first." 41 | #endif 42 | 43 | 44 | FT_BEGIN_HEADER 45 | 46 | 47 | /*************************************************************************/ 48 | /* */ 49 | /* <Section> */ 50 | /* outline_processing */ 51 | /* */ 52 | /*************************************************************************/ 53 | 54 | 55 | /*************************************************************************/ 56 | /* */ 57 | /* <Function> */ 58 | /* FT_Outline_Get_BBox */ 59 | /* */ 60 | /* <Description> */ 61 | /* Compute the exact bounding box of an outline. This is slower */ 62 | /* than computing the control box. However, it uses an advanced */ 63 | /* algorithm which returns _very_ quickly when the two boxes */ 64 | /* coincide. Otherwise, the outline Bézier arcs are traversed to */ 65 | /* extract their extrema. */ 66 | /* */ 67 | /* <Input> */ 68 | /* outline :: A pointer to the source outline. */ 69 | /* */ 70 | /* <Output> */ 71 | /* abbox :: The outline's exact bounding box. */ 72 | /* */ 73 | /* <Return> */ 74 | /* FreeType error code. 0~means success. */ 75 | /* */ 76 | /* <Note> */ 77 | /* If the font is tricky and the glyph has been loaded with */ 78 | /* @FT_LOAD_NO_SCALE, the resulting BBox is meaningless. To get */ 79 | /* reasonable values for the BBox it is necessary to load the glyph */ 80 | /* at a large ppem value (so that the hinting instructions can */ 81 | /* properly shift and scale the subglyphs), then extracting the BBox */ 82 | /* which can be eventually converted back to font units. */ 83 | /* */ 84 | FT_EXPORT( FT_Error ) 85 | FT_Outline_Get_BBox( FT_Outline* outline, 86 | FT_BBox *abbox ); 87 | 88 | 89 | /* */ 90 | 91 | 92 | FT_END_HEADER 93 | 94 | #endif /* __FTBBOX_H__ */ 95 | 96 | 97 | /* END */ 98 | 99 | 100 | /* Local Variables: */ 101 | /* coding: utf-8 */ 102 | /* End: */ 103 | -------------------------------------------------------------------------------- /fbtruetype.c: -------------------------------------------------------------------------------- 1 | /* 2 | * fbtruetype-android 3 | * 4 | * (c) 2015 by Michael Higham, <mhigham1986@gmail.com> 5 | * 6 | * This program is based on fbtruetype, written and (C) by 7 | * (c) 2001-2002 by Stefan Reinauer, <stepan@suse.de> 8 | * 9 | * This program my be redistributed under the terms of the 10 | * GNU General Public Licence, version 2, or at your preference, 11 | * any later version. 12 | */ 13 | 14 | #include <ctype.h> 15 | #include <stdlib.h> 16 | #include <stdio.h> 17 | #include <string.h> 18 | #include <unistd.h> 19 | #include <fcntl.h> 20 | #include <getopt.h> 21 | #include <sys/mman.h> 22 | #include <sys/ioctl.h> 23 | #include <linux/fb.h> 24 | #include <signal.h> 25 | 26 | #include "device.h" 27 | #include "fbtruetype.h" 28 | #include "messages.h" 29 | #include "console.h" 30 | 31 | #define reverse(x) ((x & 0x0000ff ) << 16 ) | (( x & 0x00ff00 )) | ((x & 0xff0000 ) >> 16 ) 32 | 33 | volatile int run = 1; 34 | int buffered = 0; 35 | int waitsignal = 0; 36 | int delta = 16; 37 | int sconly=0; 38 | 39 | unsigned int fbbytes, fbx, fby; 40 | unsigned int fbypos=10, fbxpos=10; 41 | unsigned int fbyposoff; 42 | unsigned int fblinelen, alpha=100; 43 | unsigned char *framebuffer, *font=DEFAULT_FONTNAME; 44 | unsigned int fontcolor=0xffffff; 45 | unsigned int fontsize=12; 46 | int boxwidth=65; 47 | int blen=3; 48 | int brightness=170; 49 | int strict_font=0; 50 | int rendertext(char *text, char *fontname, unsigned int size, unsigned int forecol); 51 | 52 | int main(int argc, char *argv[]) 53 | { 54 | char textstr[4096]; 55 | char ** line; 56 | int * len; 57 | int lines; 58 | int i; 59 | int fbdev,c,option_index; 60 | unsigned int alpha; 61 | ssize_t read(int fd, void *buf, size_t count); 62 | 63 | struct fb_var_screeninfo var; 64 | struct fb_fix_screeninfo fix; 65 | 66 | /* Initialize consoles */ 67 | init_consoles(); 68 | 69 | alpha = 100; 70 | while (1) { 71 | static struct option long_options[] = { 72 | {"help", no_argument, 0, 'h'}, 73 | {"version", no_argument, 0, 'V'}, 74 | {"info", no_argument, 0, 'i'}, 75 | {"zygote", no_argument, 0, 'z'}, 76 | {"power", no_argument, 0, 'p'}, 77 | {"clear", no_argument, 0, 'c'}, 78 | {"brightness", required_argument, 0, 'b'}, 79 | {"boxwidth", required_argument, 0, 'w'}, 80 | {"font", required_argument, 0, 'f'}, 81 | {"size", required_argument, 0, 's'}, 82 | {"textcolor", required_argument, 0, 't'}, 83 | {"alpha", required_argument, 0, 'a'}, 84 | {0, 0, 0, 0} 85 | }; 86 | 87 | c = getopt_long(argc, argv, ":x:y:h?Vizpcb:w:f:s:t:a:", 88 | long_options, &option_index); 89 | 90 | if (c == -1) 91 | break; 92 | 93 | switch (c) { 94 | case 'x': 95 | fbxpos = atoi(optarg); 96 | break; 97 | case 'y': 98 | fbypos = atoi(optarg); 99 | break; 100 | case '?': 101 | case 'h': 102 | usage(argv[0]); 103 | exit(0); 104 | case 'V': 105 | version(); 106 | exit(0); 107 | case 'i': 108 | display_info(); 109 | exit(0); 110 | case 'z': 111 | if (optind >= argc) { 112 | printf("No text\n"); 113 | exit(0); 114 | } 115 | printf("Zygote Mode.\n"); 116 | printf("Waiting for display to sleep...\n"); 117 | wait_sleep(); 118 | power_display(); 119 | set_brightness(brightness,blen); 120 | wait_wake(); 121 | clear_display(); 122 | break; 123 | case 'p': 124 | power_key(); 125 | exit(0); 126 | case 'c': 127 | clear_display(); 128 | printf("Device display cleared.\n"); 129 | exit(0); 130 | case 'b': 131 | brightness = atoi(optarg); 132 | if (brightness > 100 && brightness <= 255 ) { 133 | blen = 3; 134 | } else if (brightness <= 99 && brightness >= 10 ) { 135 | blen = 2; 136 | } else if (brightness <= 9 && brightness >= 0 ) { 137 | blen = 1; 138 | } 139 | break; 140 | case 'w': 141 | boxwidth = atoi(optarg); 142 | break; 143 | case 'f': 144 | strict_font=1; 145 | font=strdup(optarg); 146 | break; 147 | case 's': 148 | fontsize=strtol(optarg, NULL, 10); 149 | break; 150 | case 't': 151 | if (strlen(optarg) != 6) { 152 | printf("Invalid color!\n"); 153 | exit(0); 154 | } 155 | fontcolor=strtol(optarg, NULL, 16); 156 | break; 157 | case 'a': 158 | alpha = atoi(optarg); 159 | if (alpha > 100) 160 | alpha = 100; 161 | break; 162 | default: 163 | break; 164 | } 165 | } 166 | if (optind >= argc) { 167 | printf("No text\n"); 168 | exit(0); 169 | } 170 | 171 | 172 | // Power on display 173 | power_display(); 174 | 175 | // Set the brightness 176 | set_brightness(brightness,blen); 177 | 178 | // Initialize framebuffer 179 | fbdev = open("/dev/graphics/fb0", O_RDWR); 180 | if (fbdev < 0) { 181 | fprintf(stderr, "Error opening framebuffer on device.\n"); 182 | exit(fbdev); 183 | } 184 | 185 | ioctl(fbdev, FBIOGET_VSCREENINFO, &var); 186 | fbbytes = var.bits_per_pixel>>3; 187 | fbx=var.xres; 188 | fby=var.yres; 189 | ioctl(fbdev, FBIOGET_FSCREENINFO, &fix); 190 | fblinelen = fix.line_length; 191 | fbyposoff = fbypos; 192 | 193 | lines = strwrap(argv[optind], boxwidth, &line, &len); 194 | for (i = 0; i < lines; i++) 195 | { 196 | if (i > 0) 197 | { 198 | fbypos += fontsize; 199 | } 200 | if (fbypos + fontsize >= fby - fbyposoff) 201 | { 202 | exit(0); 203 | } 204 | strncpy(textstr, line[i], len[i]); 205 | textstr[len[i]] = '\0'; 206 | //printf("%4d |%-*s|\n", len[i], boxwidth, argv[optind]); 207 | framebuffer = mmap(NULL, fblinelen* fby , 208 | PROT_WRITE | PROT_READ, MAP_SHARED, fbdev, var.yoffset * fblinelen); 209 | rendertext (("%s", len[i], boxwidth, textstr), font, fontsize, reverse(fontcolor)); 210 | } 211 | 212 | free(line); 213 | free(len); 214 | return 0; 215 | } 216 | -------------------------------------------------------------------------------- /include/freetype2/freetype/ftcid.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftcid.h */ 4 | /* */ 5 | /* FreeType API for accessing CID font information (specification). */ 6 | /* */ 7 | /* Copyright 2007, 2009 by Dereg Clegg, Michael Toftdal. */ 8 | /* */ 9 | /* This file is part of the FreeType project, and may only be used, */ 10 | /* modified, and distributed under the terms of the FreeType project */ 11 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 12 | /* this file you indicate that you have read the license and */ 13 | /* understand and accept it fully. */ 14 | /* */ 15 | /***************************************************************************/ 16 | 17 | 18 | #ifndef __FTCID_H__ 19 | #define __FTCID_H__ 20 | 21 | #include <ft2build.h> 22 | #include FT_FREETYPE_H 23 | 24 | #ifdef FREETYPE_H 25 | #error "freetype.h of FreeType 1 has been loaded!" 26 | #error "Please fix the directory search order for header files" 27 | #error "so that freetype.h of FreeType 2 is found first." 28 | #endif 29 | 30 | 31 | FT_BEGIN_HEADER 32 | 33 | 34 | /*************************************************************************/ 35 | /* */ 36 | /* <Section> */ 37 | /* cid_fonts */ 38 | /* */ 39 | /* <Title> */ 40 | /* CID Fonts */ 41 | /* */ 42 | /* <Abstract> */ 43 | /* CID-keyed font specific API. */ 44 | /* */ 45 | /* <Description> */ 46 | /* This section contains the declaration of CID-keyed font specific */ 47 | /* functions. */ 48 | /* */ 49 | /*************************************************************************/ 50 | 51 | 52 | /********************************************************************** 53 | * 54 | * @function: 55 | * FT_Get_CID_Registry_Ordering_Supplement 56 | * 57 | * @description: 58 | * Retrieve the Registry/Ordering/Supplement triple (also known as the 59 | * "R/O/S") from a CID-keyed font. 60 | * 61 | * @input: 62 | * face :: 63 | * A handle to the input face. 64 | * 65 | * @output: 66 | * registry :: 67 | * The registry, as a C~string, owned by the face. 68 | * 69 | * ordering :: 70 | * The ordering, as a C~string, owned by the face. 71 | * 72 | * supplement :: 73 | * The supplement. 74 | * 75 | * @return: 76 | * FreeType error code. 0~means success. 77 | * 78 | * @note: 79 | * This function only works with CID faces, returning an error 80 | * otherwise. 81 | * 82 | * @since: 83 | * 2.3.6 84 | */ 85 | FT_EXPORT( FT_Error ) 86 | FT_Get_CID_Registry_Ordering_Supplement( FT_Face face, 87 | const char* *registry, 88 | const char* *ordering, 89 | FT_Int *supplement); 90 | 91 | 92 | /********************************************************************** 93 | * 94 | * @function: 95 | * FT_Get_CID_Is_Internally_CID_Keyed 96 | * 97 | * @description: 98 | * Retrieve the type of the input face, CID keyed or not. In 99 | * constrast to the @FT_IS_CID_KEYED macro this function returns 100 | * successfully also for CID-keyed fonts in an SNFT wrapper. 101 | * 102 | * @input: 103 | * face :: 104 | * A handle to the input face. 105 | * 106 | * @output: 107 | * is_cid :: 108 | * The type of the face as an @FT_Bool. 109 | * 110 | * @return: 111 | * FreeType error code. 0~means success. 112 | * 113 | * @note: 114 | * This function only works with CID faces and OpenType fonts, 115 | * returning an error otherwise. 116 | * 117 | * @since: 118 | * 2.3.9 119 | */ 120 | FT_EXPORT( FT_Error ) 121 | FT_Get_CID_Is_Internally_CID_Keyed( FT_Face face, 122 | FT_Bool *is_cid ); 123 | 124 | 125 | /********************************************************************** 126 | * 127 | * @function: 128 | * FT_Get_CID_From_Glyph_Index 129 | * 130 | * @description: 131 | * Retrieve the CID of the input glyph index. 132 | * 133 | * @input: 134 | * face :: 135 | * A handle to the input face. 136 | * 137 | * glyph_index :: 138 | * The input glyph index. 139 | * 140 | * @output: 141 | * cid :: 142 | * The CID as an @FT_UInt. 143 | * 144 | * @return: 145 | * FreeType error code. 0~means success. 146 | * 147 | * @note: 148 | * This function only works with CID faces and OpenType fonts, 149 | * returning an error otherwise. 150 | * 151 | * @since: 152 | * 2.3.9 153 | */ 154 | FT_EXPORT( FT_Error ) 155 | FT_Get_CID_From_Glyph_Index( FT_Face face, 156 | FT_UInt glyph_index, 157 | FT_UInt *cid ); 158 | 159 | /* */ 160 | 161 | FT_END_HEADER 162 | 163 | #endif /* __FTCID_H__ */ 164 | 165 | 166 | /* END */ 167 | -------------------------------------------------------------------------------- /include/freetype2/freetype/ftpfr.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftpfr.h */ 4 | /* */ 5 | /* FreeType API for accessing PFR-specific data (specification only). */ 6 | /* */ 7 | /* Copyright 2002, 2003, 2004, 2006, 2008, 2009 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 __FTPFR_H__ 20 | #define __FTPFR_H__ 21 | 22 | #include <ft2build.h> 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | 35 | /*************************************************************************/ 36 | /* */ 37 | /* <Section> */ 38 | /* pfr_fonts */ 39 | /* */ 40 | /* <Title> */ 41 | /* PFR Fonts */ 42 | /* */ 43 | /* <Abstract> */ 44 | /* PFR/TrueDoc specific API. */ 45 | /* */ 46 | /* <Description> */ 47 | /* This section contains the declaration of PFR-specific functions. */ 48 | /* */ 49 | /*************************************************************************/ 50 | 51 | 52 | /********************************************************************** 53 | * 54 | * @function: 55 | * FT_Get_PFR_Metrics 56 | * 57 | * @description: 58 | * Return the outline and metrics resolutions of a given PFR face. 59 | * 60 | * @input: 61 | * face :: Handle to the input face. It can be a non-PFR face. 62 | * 63 | * @output: 64 | * aoutline_resolution :: 65 | * Outline resolution. This is equivalent to `face->units_per_EM' 66 | * for non-PFR fonts. Optional (parameter can be NULL). 67 | * 68 | * ametrics_resolution :: 69 | * Metrics resolution. This is equivalent to `outline_resolution' 70 | * for non-PFR fonts. Optional (parameter can be NULL). 71 | * 72 | * ametrics_x_scale :: 73 | * A 16.16 fixed-point number used to scale distance expressed 74 | * in metrics units to device sub-pixels. This is equivalent to 75 | * `face->size->x_scale', but for metrics only. Optional (parameter 76 | * can be NULL). 77 | * 78 | * ametrics_y_scale :: 79 | * Same as `ametrics_x_scale' but for the vertical direction. 80 | * optional (parameter can be NULL). 81 | * 82 | * @return: 83 | * FreeType error code. 0~means success. 84 | * 85 | * @note: 86 | * If the input face is not a PFR, this function will return an error. 87 | * However, in all cases, it will return valid values. 88 | */ 89 | FT_EXPORT( FT_Error ) 90 | FT_Get_PFR_Metrics( FT_Face face, 91 | FT_UInt *aoutline_resolution, 92 | FT_UInt *ametrics_resolution, 93 | FT_Fixed *ametrics_x_scale, 94 | FT_Fixed *ametrics_y_scale ); 95 | 96 | 97 | /********************************************************************** 98 | * 99 | * @function: 100 | * FT_Get_PFR_Kerning 101 | * 102 | * @description: 103 | * Return the kerning pair corresponding to two glyphs in a PFR face. 104 | * The distance is expressed in metrics units, unlike the result of 105 | * @FT_Get_Kerning. 106 | * 107 | * @input: 108 | * face :: A handle to the input face. 109 | * 110 | * left :: Index of the left glyph. 111 | * 112 | * right :: Index of the right glyph. 113 | * 114 | * @output: 115 | * avector :: A kerning vector. 116 | * 117 | * @return: 118 | * FreeType error code. 0~means success. 119 | * 120 | * @note: 121 | * This function always return distances in original PFR metrics 122 | * units. This is unlike @FT_Get_Kerning with the @FT_KERNING_UNSCALED 123 | * mode, which always returns distances converted to outline units. 124 | * 125 | * You can use the value of the `x_scale' and `y_scale' parameters 126 | * returned by @FT_Get_PFR_Metrics to scale these to device sub-pixels. 127 | */ 128 | FT_EXPORT( FT_Error ) 129 | FT_Get_PFR_Kerning( FT_Face face, 130 | FT_UInt left, 131 | FT_UInt right, 132 | FT_Vector *avector ); 133 | 134 | 135 | /********************************************************************** 136 | * 137 | * @function: 138 | * FT_Get_PFR_Advance 139 | * 140 | * @description: 141 | * Return a given glyph advance, expressed in original metrics units, 142 | * from a PFR font. 143 | * 144 | * @input: 145 | * face :: A handle to the input face. 146 | * 147 | * gindex :: The glyph index. 148 | * 149 | * @output: 150 | * aadvance :: The glyph advance in metrics units. 151 | * 152 | * @return: 153 | * FreeType error code. 0~means success. 154 | * 155 | * @note: 156 | * You can use the `x_scale' or `y_scale' results of @FT_Get_PFR_Metrics 157 | * to convert the advance to device sub-pixels (i.e., 1/64th of pixels). 158 | */ 159 | FT_EXPORT( FT_Error ) 160 | FT_Get_PFR_Advance( FT_Face face, 161 | FT_UInt gindex, 162 | FT_Pos *aadvance ); 163 | 164 | /* */ 165 | 166 | 167 | FT_END_HEADER 168 | 169 | #endif /* __FTPFR_H__ */ 170 | 171 | 172 | /* END */ 173 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------- 2 | FBTrueType for Android 3 | -------------------------------------------------------------------------- 4 | 5 | ----------- 6 | What is it? 7 | ----------- 8 | 9 | FBTrueType is a standalone native ARM program for ROOTED Android devices, 10 | which renders TrueType text to the device display, using the kernel 11 | framebuffer and the freetype2 library. 12 | 13 | 14 | -------- 15 | Building 16 | -------- 17 | 18 | You must be able to cross compile for ARM, on Ubuntu 14.04 for example 19 | you will need to install the following: 20 | 21 | $ sudo apt-get install libc6-armel-cross libc6-dev-armel-cross 22 | $ sudo apt-get install libncurses5-dev 23 | $ sudo apt-get install binutils-arm-linux-gnueabi 24 | $ sudo apt-get install gcc-arm-linux-gnueabi 25 | 26 | Once you are setup to cross compile for ARM, to build the program run 27 | 28 | $ make 29 | 30 | If you need to rebuild run: 31 | 32 | $ make clean 33 | $ make 34 | 35 | 36 | ------------ 37 | Installation 38 | ------------ 39 | 40 | Once compiled, you will need to push this file to your ROOTED device, it 41 | is probably a good idea to put it on the SDCARD: 42 | 43 | $ adb push fbtruetype /sdcard/ 44 | 45 | Now you need to login the device with ADB, and remount the /system 46 | partition as Read/Write like this: 47 | 48 | $ adb shell 49 | $ su 50 | $ mount -o rw,remount /system 51 | 52 | Now still in the same ADB shell, you should copy the file to /system/xbin 53 | and then enable executable permissions, before remounting 54 | the /system partition as Read-Only again: 55 | 56 | $ cp /sdcard/fbtruetype /system/xbin/ 57 | $ chmod 755 /system/xbin/fbtruetype 58 | $ mount -o ro,remount /system 59 | 60 | That's it. Normally, in order to run the program you must be root in 61 | the ADB shell, so you would login and then SU like this: 62 | 63 | $ adb shell 64 | $ su 65 | $ fbtruetype 66 | 67 | 68 | ----- 69 | Usage 70 | ----- 71 | 72 | Usage: 73 | fbtruetype [OPTION] [TEXT] 74 | 75 | Options: 76 | 77 | -?, -h, --help: Print this help. 78 | -V, --version: Show version. 79 | -i, --info: Print device display information. 80 | 81 | -z, --zygote: Zygote mode. 82 | -p, --power: Send power key event. 83 | -c, --clear Clear the device display. 84 | 85 | -x: X coordinate pixel [default 10] 86 | -y: Y coordinate pixel [default 10] 87 | -b, --brightness: Set display brightness [0-255] [default 170] 88 | -w, --boxwidth: Text box column size [default 65] 89 | -f, --font: Font name [.ttf file] 90 | -s, --size: Font size [default 12] 91 | -t, --textcolor: Font color [RGB Hex: FFFFFF] 92 | -a, --alpha: Alpha channel [1-100] 93 | 94 | 95 | ----------- 96 | Usage Notes 97 | ----------- 98 | 99 | With Zygote 100 | ----------- 101 | 102 | If you try to execute the program with Zygote running, then 103 | the framebuffer will still be locked by Zygote and text will 104 | only be displayed for a brief second. To circumvent this 105 | there is an option --zygote which captures the display from 106 | Zygote when the display is in sleep mode. Only when the 107 | display is off (i.e, device is in lock state and the screen 108 | is dimmed) will this mode work. To reset the display just 109 | issue the --power option or press the power button on the 110 | device. Once the framebuffer has been captured from Zygote, 111 | the program will work in normal mode. 112 | 113 | **Note: With Zygote running the display may be written to by 114 | Zygote when a screen change event happens such as when you 115 | receive a call, SMS, clock widgets etc... 116 | 117 | ------------------------- 118 | Without Zygote (Headless) 119 | ------------------------- 120 | 121 | If you prefer to kill Zygote or you experience corrpution on 122 | the display using Zygote more then you should stop the Zygote 123 | process completely by issuing the following commands: 124 | 125 | $ adb shell 126 | $ su 127 | $ stop 128 | 129 | The "stop" command will completely shutdown Zygote and all child 130 | processes. After doing this it is necessary to clear the device 131 | display using the -c or --clear command options: 132 | 133 | $ fbtruetype --clear 134 | 135 | The display is now ready for some text, to restart Zygote just 136 | issue the following as root in ADB: 137 | 138 | $ start 139 | 140 | **Note: Without Zygote running you will be unable to use android 141 | functions like receiving calls or SMS etc... 142 | 143 | 144 | -------- 145 | Examples 146 | -------- 147 | 148 | Send some text to the display: 149 | 150 | $ fbtruetype "TEST" 151 | 152 | 153 | Clear the display: 154 | 155 | $ fbtruetype -c 156 | 157 | or use: 158 | 159 | $ fbtruetype --clear 160 | 161 | 162 | Change the text box column width to 30: 163 | 164 | $ fbtruetype -w 30 "The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog." 165 | 166 | 167 | Send text with Zygote still running: 168 | 169 | $ fbtruetype -z "TEST" 170 | 171 | 172 | Use the font DroidSans (Android fonts are located in 173 | /system/fonts/): 174 | 175 | $ fbtruetype -f /system/fonts/DroidSans.ttf "TEST" 176 | 177 | 178 | Use the font DroidSans and set the font size to 36: 179 | 180 | $ fbtruetype -s 36 -f /system/fonts/DroidSans.ttf "TEST" 181 | 182 | 183 | Set the font color to green: 184 | 185 | $ fbtruetype -t 00FF00 "TEST" 186 | 187 | 188 | Set the display brightness to 150: 189 | 190 | $ fbtruetype -b 150 "TEST" 191 | 192 | 193 | Set the text position to X=50 and Y=100: 194 | 195 | $ fbtruetype -x 50 -y 100 "TEST" 196 | 197 | 198 | Simulate the power button (turn display ON/OFF): 199 | 200 | $ fbtruetype -p 201 | 202 | 203 | ------------ 204 | Test Script 205 | ------------ 206 | 207 | In the test directory you will find a script called devinfo.sh 208 | Copy this to the device and run it like this: 209 | 210 | $ adb push test/devinfo.sh /sdcard/ 211 | 212 | Then open a ADB shell, SU to root and then copy the script 213 | to the /data/ directory where it can be executed from. 214 | Then change permissions to executable: 215 | 216 | $ adb shell 217 | $ adb su 218 | $ cp /sdcard/devinfo.sh /data/ 219 | $ chmod 755 /data/devinfo.sh 220 | 221 | Now run the script to view basic device information on the 222 | display of the device. 223 | 224 | $ /data/devinfo.sh 225 | 226 | ----- 227 | Notes 228 | ----- 229 | 230 | This program has only been tested on an old HTC ARMv7l, therefore 231 | it might be incompatible or even damage your device. I hold no 232 | liability for any damage or otherwise which you may cause to 233 | your device by using this program. 234 | 235 | 236 | --------- 237 | Licensing 238 | --------- 239 | 240 | Please see the file called LICENSE. 241 | 242 | 243 | ------- 244 | Credits 245 | ------- 246 | 247 | (c) 2015 by Michael Higham, <mhigham1986@gmail.com> 248 | 249 | This program is based on fbtruetype, written and (C) by 250 | (c) 2001-2002 by Stefan Reinauer, <stepan@suse.de> 251 | 252 | This program my be redistributed under the terms of the 253 | GNU General Public Licence, version 2, or at your preference, 254 | any later version. 255 | 256 | -------------------------------------------------------------------------------- /include/freetype2/freetype/ftchapters.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* This file defines the structure of the FreeType reference. */ 4 | /* It is used by the python script which generates the HTML files. */ 5 | /* */ 6 | /***************************************************************************/ 7 | 8 | 9 | /***************************************************************************/ 10 | /* */ 11 | /* <Chapter> */ 12 | /* general_remarks */ 13 | /* */ 14 | /* <Title> */ 15 | /* General Remarks */ 16 | /* */ 17 | /* <Sections> */ 18 | /* user_allocation */ 19 | /* */ 20 | /***************************************************************************/ 21 | 22 | 23 | /***************************************************************************/ 24 | /* */ 25 | /* <Chapter> */ 26 | /* core_api */ 27 | /* */ 28 | /* <Title> */ 29 | /* Core API */ 30 | /* */ 31 | /* <Sections> */ 32 | /* version */ 33 | /* basic_types */ 34 | /* base_interface */ 35 | /* glyph_variants */ 36 | /* glyph_management */ 37 | /* mac_specific */ 38 | /* sizes_management */ 39 | /* header_file_macros */ 40 | /* */ 41 | /***************************************************************************/ 42 | 43 | 44 | /***************************************************************************/ 45 | /* */ 46 | /* <Chapter> */ 47 | /* format_specific */ 48 | /* */ 49 | /* <Title> */ 50 | /* Format-Specific API */ 51 | /* */ 52 | /* <Sections> */ 53 | /* multiple_masters */ 54 | /* truetype_tables */ 55 | /* type1_tables */ 56 | /* sfnt_names */ 57 | /* bdf_fonts */ 58 | /* cid_fonts */ 59 | /* pfr_fonts */ 60 | /* winfnt_fonts */ 61 | /* font_formats */ 62 | /* gasp_table */ 63 | /* */ 64 | /***************************************************************************/ 65 | 66 | 67 | /***************************************************************************/ 68 | /* */ 69 | /* <Chapter> */ 70 | /* cache_subsystem */ 71 | /* */ 72 | /* <Title> */ 73 | /* Cache Sub-System */ 74 | /* */ 75 | /* <Sections> */ 76 | /* cache_subsystem */ 77 | /* */ 78 | /***************************************************************************/ 79 | 80 | 81 | /***************************************************************************/ 82 | /* */ 83 | /* <Chapter> */ 84 | /* support_api */ 85 | /* */ 86 | /* <Title> */ 87 | /* Support API */ 88 | /* */ 89 | /* <Sections> */ 90 | /* computations */ 91 | /* list_processing */ 92 | /* outline_processing */ 93 | /* quick_advance */ 94 | /* bitmap_handling */ 95 | /* raster */ 96 | /* glyph_stroker */ 97 | /* system_interface */ 98 | /* module_management */ 99 | /* gzip */ 100 | /* lzw */ 101 | /* bzip2 */ 102 | /* lcd_filtering */ 103 | /* */ 104 | /***************************************************************************/ 105 | -------------------------------------------------------------------------------- /include/freetype2/freetype/ftbdf.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftbdf.h */ 4 | /* */ 5 | /* FreeType API for accessing BDF-specific strings (specification). */ 6 | /* */ 7 | /* Copyright 2002, 2003, 2004, 2006, 2009 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 __FTBDF_H__ 20 | #define __FTBDF_H__ 21 | 22 | #include <ft2build.h> 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | 35 | /*************************************************************************/ 36 | /* */ 37 | /* <Section> */ 38 | /* bdf_fonts */ 39 | /* */ 40 | /* <Title> */ 41 | /* BDF and PCF Files */ 42 | /* */ 43 | /* <Abstract> */ 44 | /* BDF and PCF specific API. */ 45 | /* */ 46 | /* <Description> */ 47 | /* This section contains the declaration of functions specific to BDF */ 48 | /* and PCF fonts. */ 49 | /* */ 50 | /*************************************************************************/ 51 | 52 | 53 | /********************************************************************** 54 | * 55 | * @enum: 56 | * FT_PropertyType 57 | * 58 | * @description: 59 | * A list of BDF property types. 60 | * 61 | * @values: 62 | * BDF_PROPERTY_TYPE_NONE :: 63 | * Value~0 is used to indicate a missing property. 64 | * 65 | * BDF_PROPERTY_TYPE_ATOM :: 66 | * Property is a string atom. 67 | * 68 | * BDF_PROPERTY_TYPE_INTEGER :: 69 | * Property is a 32-bit signed integer. 70 | * 71 | * BDF_PROPERTY_TYPE_CARDINAL :: 72 | * Property is a 32-bit unsigned integer. 73 | */ 74 | typedef enum BDF_PropertyType_ 75 | { 76 | BDF_PROPERTY_TYPE_NONE = 0, 77 | BDF_PROPERTY_TYPE_ATOM = 1, 78 | BDF_PROPERTY_TYPE_INTEGER = 2, 79 | BDF_PROPERTY_TYPE_CARDINAL = 3 80 | 81 | } BDF_PropertyType; 82 | 83 | 84 | /********************************************************************** 85 | * 86 | * @type: 87 | * BDF_Property 88 | * 89 | * @description: 90 | * A handle to a @BDF_PropertyRec structure to model a given 91 | * BDF/PCF property. 92 | */ 93 | typedef struct BDF_PropertyRec_* BDF_Property; 94 | 95 | 96 | /********************************************************************** 97 | * 98 | * @struct: 99 | * BDF_PropertyRec 100 | * 101 | * @description: 102 | * This structure models a given BDF/PCF property. 103 | * 104 | * @fields: 105 | * type :: 106 | * The property type. 107 | * 108 | * u.atom :: 109 | * The atom string, if type is @BDF_PROPERTY_TYPE_ATOM. 110 | * 111 | * u.integer :: 112 | * A signed integer, if type is @BDF_PROPERTY_TYPE_INTEGER. 113 | * 114 | * u.cardinal :: 115 | * An unsigned integer, if type is @BDF_PROPERTY_TYPE_CARDINAL. 116 | */ 117 | typedef struct BDF_PropertyRec_ 118 | { 119 | BDF_PropertyType type; 120 | union { 121 | const char* atom; 122 | FT_Int32 integer; 123 | FT_UInt32 cardinal; 124 | 125 | } u; 126 | 127 | } BDF_PropertyRec; 128 | 129 | 130 | /********************************************************************** 131 | * 132 | * @function: 133 | * FT_Get_BDF_Charset_ID 134 | * 135 | * @description: 136 | * Retrieve a BDF font character set identity, according to 137 | * the BDF specification. 138 | * 139 | * @input: 140 | * face :: 141 | * A handle to the input face. 142 | * 143 | * @output: 144 | * acharset_encoding :: 145 | * Charset encoding, as a C~string, owned by the face. 146 | * 147 | * acharset_registry :: 148 | * Charset registry, as a C~string, owned by the face. 149 | * 150 | * @return: 151 | * FreeType error code. 0~means success. 152 | * 153 | * @note: 154 | * This function only works with BDF faces, returning an error otherwise. 155 | */ 156 | FT_EXPORT( FT_Error ) 157 | FT_Get_BDF_Charset_ID( FT_Face face, 158 | const char* *acharset_encoding, 159 | const char* *acharset_registry ); 160 | 161 | 162 | /********************************************************************** 163 | * 164 | * @function: 165 | * FT_Get_BDF_Property 166 | * 167 | * @description: 168 | * Retrieve a BDF property from a BDF or PCF font file. 169 | * 170 | * @input: 171 | * face :: A handle to the input face. 172 | * 173 | * name :: The property name. 174 | * 175 | * @output: 176 | * aproperty :: The property. 177 | * 178 | * @return: 179 | * FreeType error code. 0~means success. 180 | * 181 | * @note: 182 | * This function works with BDF _and_ PCF fonts. It returns an error 183 | * otherwise. It also returns an error if the property is not in the 184 | * font. 185 | * 186 | * A `property' is a either key-value pair within the STARTPROPERTIES 187 | * ... ENDPROPERTIES block of a BDF font or a key-value pair from the 188 | * `info->props' array within a `FontRec' structure of a PCF font. 189 | * 190 | * Integer properties are always stored as `signed' within PCF fonts; 191 | * consequently, @BDF_PROPERTY_TYPE_CARDINAL is a possible return value 192 | * for BDF fonts only. 193 | * 194 | * In case of error, `aproperty->type' is always set to 195 | * @BDF_PROPERTY_TYPE_NONE. 196 | */ 197 | FT_EXPORT( FT_Error ) 198 | FT_Get_BDF_Property( FT_Face face, 199 | const char* prop_name, 200 | BDF_PropertyRec *aproperty ); 201 | 202 | /* */ 203 | 204 | FT_END_HEADER 205 | 206 | #endif /* __FTBDF_H__ */ 207 | 208 | 209 | /* END */ 210 | -------------------------------------------------------------------------------- /include/freetype2/freetype/ftotval.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftotval.h */ 4 | /* */ 5 | /* FreeType API for validating OpenType tables (specification). */ 6 | /* */ 7 | /* Copyright 2004, 2005, 2006, 2007 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 | /***************************************************************************/ 20 | /* */ 21 | /* */ 22 | /* Warning: This module might be moved to a different library in the */ 23 | /* future to avoid a tight dependency between FreeType and the */ 24 | /* OpenType specification. */ 25 | /* */ 26 | /* */ 27 | /***************************************************************************/ 28 | 29 | 30 | #ifndef __FTOTVAL_H__ 31 | #define __FTOTVAL_H__ 32 | 33 | #include <ft2build.h> 34 | #include FT_FREETYPE_H 35 | 36 | #ifdef FREETYPE_H 37 | #error "freetype.h of FreeType 1 has been loaded!" 38 | #error "Please fix the directory search order for header files" 39 | #error "so that freetype.h of FreeType 2 is found first." 40 | #endif 41 | 42 | 43 | FT_BEGIN_HEADER 44 | 45 | 46 | /*************************************************************************/ 47 | /* */ 48 | /* <Section> */ 49 | /* ot_validation */ 50 | /* */ 51 | /* <Title> */ 52 | /* OpenType Validation */ 53 | /* */ 54 | /* <Abstract> */ 55 | /* An API to validate OpenType tables. */ 56 | /* */ 57 | /* <Description> */ 58 | /* This section contains the declaration of functions to validate */ 59 | /* some OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH). */ 60 | /* */ 61 | /*************************************************************************/ 62 | 63 | 64 | /********************************************************************** 65 | * 66 | * @enum: 67 | * FT_VALIDATE_OTXXX 68 | * 69 | * @description: 70 | * A list of bit-field constants used with @FT_OpenType_Validate to 71 | * indicate which OpenType tables should be validated. 72 | * 73 | * @values: 74 | * FT_VALIDATE_BASE :: 75 | * Validate BASE table. 76 | * 77 | * FT_VALIDATE_GDEF :: 78 | * Validate GDEF table. 79 | * 80 | * FT_VALIDATE_GPOS :: 81 | * Validate GPOS table. 82 | * 83 | * FT_VALIDATE_GSUB :: 84 | * Validate GSUB table. 85 | * 86 | * FT_VALIDATE_JSTF :: 87 | * Validate JSTF table. 88 | * 89 | * FT_VALIDATE_MATH :: 90 | * Validate MATH table. 91 | * 92 | * FT_VALIDATE_OT :: 93 | * Validate all OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH). 94 | * 95 | */ 96 | #define FT_VALIDATE_BASE 0x0100 97 | #define FT_VALIDATE_GDEF 0x0200 98 | #define FT_VALIDATE_GPOS 0x0400 99 | #define FT_VALIDATE_GSUB 0x0800 100 | #define FT_VALIDATE_JSTF 0x1000 101 | #define FT_VALIDATE_MATH 0x2000 102 | 103 | #define FT_VALIDATE_OT FT_VALIDATE_BASE | \ 104 | FT_VALIDATE_GDEF | \ 105 | FT_VALIDATE_GPOS | \ 106 | FT_VALIDATE_GSUB | \ 107 | FT_VALIDATE_JSTF | \ 108 | FT_VALIDATE_MATH 109 | 110 | /* */ 111 | 112 | /********************************************************************** 113 | * 114 | * @function: 115 | * FT_OpenType_Validate 116 | * 117 | * @description: 118 | * Validate various OpenType tables to assure that all offsets and 119 | * indices are valid. The idea is that a higher-level library which 120 | * actually does the text layout can access those tables without 121 | * error checking (which can be quite time consuming). 122 | * 123 | * @input: 124 | * face :: 125 | * A handle to the input face. 126 | * 127 | * validation_flags :: 128 | * A bit field which specifies the tables to be validated. See 129 | * @FT_VALIDATE_OTXXX for possible values. 130 | * 131 | * @output: 132 | * BASE_table :: 133 | * A pointer to the BASE table. 134 | * 135 | * GDEF_table :: 136 | * A pointer to the GDEF table. 137 | * 138 | * GPOS_table :: 139 | * A pointer to the GPOS table. 140 | * 141 | * GSUB_table :: 142 | * A pointer to the GSUB table. 143 | * 144 | * JSTF_table :: 145 | * A pointer to the JSTF table. 146 | * 147 | * @return: 148 | * FreeType error code. 0~means success. 149 | * 150 | * @note: 151 | * This function only works with OpenType fonts, returning an error 152 | * otherwise. 153 | * 154 | * After use, the application should deallocate the five tables with 155 | * @FT_OpenType_Free. A NULL value indicates that the table either 156 | * doesn't exist in the font, or the application hasn't asked for 157 | * validation. 158 | */ 159 | FT_EXPORT( FT_Error ) 160 | FT_OpenType_Validate( FT_Face face, 161 | FT_UInt validation_flags, 162 | FT_Bytes *BASE_table, 163 | FT_Bytes *GDEF_table, 164 | FT_Bytes *GPOS_table, 165 | FT_Bytes *GSUB_table, 166 | FT_Bytes *JSTF_table ); 167 | 168 | /* */ 169 | 170 | /********************************************************************** 171 | * 172 | * @function: 173 | * FT_OpenType_Free 174 | * 175 | * @description: 176 | * Free the buffer allocated by OpenType validator. 177 | * 178 | * @input: 179 | * face :: 180 | * A handle to the input face. 181 | * 182 | * table :: 183 | * The pointer to the buffer that is allocated by 184 | * @FT_OpenType_Validate. 185 | * 186 | * @note: 187 | * This function must be used to free the buffer allocated by 188 | * @FT_OpenType_Validate only. 189 | */ 190 | FT_EXPORT( void ) 191 | FT_OpenType_Free( FT_Face face, 192 | FT_Bytes table ); 193 | 194 | 195 | /* */ 196 | 197 | 198 | FT_END_HEADER 199 | 200 | #endif /* __FTOTVAL_H__ */ 201 | 202 | 203 | /* END */ 204 | -------------------------------------------------------------------------------- /include/freetype2/freetype/config/ftstdlib.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftstdlib.h */ 4 | /* */ 5 | /* ANSI-specific library and header configuration file (specification */ 6 | /* only). */ 7 | /* */ 8 | /* Copyright 2002-2007, 2009, 2011 by */ 9 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 10 | /* */ 11 | /* This file is part of the FreeType project, and may only be used, */ 12 | /* modified, and distributed under the terms of the FreeType project */ 13 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 14 | /* this file you indicate that you have read the license and */ 15 | /* understand and accept it fully. */ 16 | /* */ 17 | /***************************************************************************/ 18 | 19 | 20 | /*************************************************************************/ 21 | /* */ 22 | /* This file is used to group all #includes to the ANSI C library that */ 23 | /* FreeType normally requires. It also defines macros to rename the */ 24 | /* standard functions within the FreeType source code. */ 25 | /* */ 26 | /* Load a file which defines __FTSTDLIB_H__ before this one to override */ 27 | /* it. */ 28 | /* */ 29 | /*************************************************************************/ 30 | 31 | 32 | #ifndef __FTSTDLIB_H__ 33 | #define __FTSTDLIB_H__ 34 | 35 | 36 | #include <stddef.h> 37 | 38 | #define ft_ptrdiff_t ptrdiff_t 39 | 40 | 41 | /**********************************************************************/ 42 | /* */ 43 | /* integer limits */ 44 | /* */ 45 | /* UINT_MAX and ULONG_MAX are used to automatically compute the size */ 46 | /* of `int' and `long' in bytes at compile-time. So far, this works */ 47 | /* for all platforms the library has been tested on. */ 48 | /* */ 49 | /* Note that on the extremely rare platforms that do not provide */ 50 | /* integer types that are _exactly_ 16 and 32 bits wide (e.g. some */ 51 | /* old Crays where `int' is 36 bits), we do not make any guarantee */ 52 | /* about the correct behaviour of FT2 with all fonts. */ 53 | /* */ 54 | /* In these case, `ftconfig.h' will refuse to compile anyway with a */ 55 | /* message like `couldn't find 32-bit type' or something similar. */ 56 | /* */ 57 | /**********************************************************************/ 58 | 59 | 60 | #include <limits.h> 61 | 62 | #define FT_CHAR_BIT CHAR_BIT 63 | #define FT_USHORT_MAX USHRT_MAX 64 | #define FT_INT_MAX INT_MAX 65 | #define FT_INT_MIN INT_MIN 66 | #define FT_UINT_MAX UINT_MAX 67 | #define FT_ULONG_MAX ULONG_MAX 68 | 69 | 70 | /**********************************************************************/ 71 | /* */ 72 | /* character and string processing */ 73 | /* */ 74 | /**********************************************************************/ 75 | 76 | 77 | #include <string.h> 78 | 79 | #define ft_memchr memchr 80 | #define ft_memcmp memcmp 81 | #define ft_memcpy memcpy 82 | #define ft_memmove memmove 83 | #define ft_memset memset 84 | #define ft_strcat strcat 85 | #define ft_strcmp strcmp 86 | #define ft_strcpy strcpy 87 | #define ft_strlen strlen 88 | #define ft_strncmp strncmp 89 | #define ft_strncpy strncpy 90 | #define ft_strrchr strrchr 91 | #define ft_strstr strstr 92 | 93 | 94 | /**********************************************************************/ 95 | /* */ 96 | /* file handling */ 97 | /* */ 98 | /**********************************************************************/ 99 | 100 | 101 | #include <stdio.h> 102 | 103 | #define FT_FILE FILE 104 | #define ft_fclose fclose 105 | #define ft_fopen fopen 106 | #define ft_fread fread 107 | #define ft_fseek fseek 108 | #define ft_ftell ftell 109 | #define ft_sprintf sprintf 110 | 111 | 112 | /**********************************************************************/ 113 | /* */ 114 | /* sorting */ 115 | /* */ 116 | /**********************************************************************/ 117 | 118 | 119 | #include <stdlib.h> 120 | 121 | #define ft_qsort qsort 122 | 123 | 124 | /**********************************************************************/ 125 | /* */ 126 | /* memory allocation */ 127 | /* */ 128 | /**********************************************************************/ 129 | 130 | 131 | #define ft_scalloc calloc 132 | #define ft_sfree free 133 | #define ft_smalloc malloc 134 | #define ft_srealloc realloc 135 | 136 | 137 | /**********************************************************************/ 138 | /* */ 139 | /* miscellaneous */ 140 | /* */ 141 | /**********************************************************************/ 142 | 143 | 144 | #define ft_atol atol 145 | #define ft_labs labs 146 | 147 | 148 | /**********************************************************************/ 149 | /* */ 150 | /* execution control */ 151 | /* */ 152 | /**********************************************************************/ 153 | 154 | 155 | #include <setjmp.h> 156 | 157 | #define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */ 158 | /* jmp_buf is defined as a macro */ 159 | /* on certain platforms */ 160 | 161 | #define ft_longjmp longjmp 162 | #define ft_setjmp( b ) setjmp( *(jmp_buf*) &(b) ) /* same thing here */ 163 | 164 | 165 | /* the following is only used for debugging purposes, i.e., if */ 166 | /* FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined */ 167 | 168 | #include <stdarg.h> 169 | 170 | 171 | #endif /* __FTSTDLIB_H__ */ 172 | 173 | 174 | /* END */ 175 | -------------------------------------------------------------------------------- /include/freetype2/freetype/ftmoderr.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftmoderr.h */ 4 | /* */ 5 | /* FreeType module error offsets (specification). */ 6 | /* */ 7 | /* Copyright 2001, 2002, 2003, 2004, 2005, 2010 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 | /*************************************************************************/ 20 | /* */ 21 | /* This file is used to define the FreeType module error offsets. */ 22 | /* */ 23 | /* The lower byte gives the error code, the higher byte gives the */ 24 | /* module. The base module has error offset 0. For example, the error */ 25 | /* `FT_Err_Invalid_File_Format' has value 0x003, the error */ 26 | /* `TT_Err_Invalid_File_Format' has value 0x1103, the error */ 27 | /* `T1_Err_Invalid_File_Format' has value 0x1203, etc. */ 28 | /* */ 29 | /* Undefine the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in ftoption.h */ 30 | /* to make the higher byte always zero (disabling the module error */ 31 | /* mechanism). */ 32 | /* */ 33 | /* It can also be used to create a module error message table easily */ 34 | /* with something like */ 35 | /* */ 36 | /* { */ 37 | /* #undef __FTMODERR_H__ */ 38 | /* #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s }, */ 39 | /* #define FT_MODERR_START_LIST { */ 40 | /* #define FT_MODERR_END_LIST { 0, 0 } }; */ 41 | /* */ 42 | /* const struct */ 43 | /* { */ 44 | /* int mod_err_offset; */ 45 | /* const char* mod_err_msg */ 46 | /* } ft_mod_errors[] = */ 47 | /* */ 48 | /* #include FT_MODULE_ERRORS_H */ 49 | /* } */ 50 | /* */ 51 | /* To use such a table, all errors must be ANDed with 0xFF00 to remove */ 52 | /* the error code. */ 53 | /* */ 54 | /*************************************************************************/ 55 | 56 | 57 | #ifndef __FTMODERR_H__ 58 | #define __FTMODERR_H__ 59 | 60 | 61 | /*******************************************************************/ 62 | /*******************************************************************/ 63 | /***** *****/ 64 | /***** SETUP MACROS *****/ 65 | /***** *****/ 66 | /*******************************************************************/ 67 | /*******************************************************************/ 68 | 69 | 70 | #undef FT_NEED_EXTERN_C 71 | 72 | #ifndef FT_MODERRDEF 73 | 74 | #ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS 75 | #define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = v, 76 | #else 77 | #define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = 0, 78 | #endif 79 | 80 | #define FT_MODERR_START_LIST enum { 81 | #define FT_MODERR_END_LIST FT_Mod_Err_Max }; 82 | 83 | #ifdef __cplusplus 84 | #define FT_NEED_EXTERN_C 85 | extern "C" { 86 | #endif 87 | 88 | #endif /* !FT_MODERRDEF */ 89 | 90 | 91 | /*******************************************************************/ 92 | /*******************************************************************/ 93 | /***** *****/ 94 | /***** LIST MODULE ERROR BASES *****/ 95 | /***** *****/ 96 | /*******************************************************************/ 97 | /*******************************************************************/ 98 | 99 | 100 | #ifdef FT_MODERR_START_LIST 101 | FT_MODERR_START_LIST 102 | #endif 103 | 104 | 105 | FT_MODERRDEF( Base, 0x000, "base module" ) 106 | FT_MODERRDEF( Autofit, 0x100, "autofitter module" ) 107 | FT_MODERRDEF( BDF, 0x200, "BDF module" ) 108 | FT_MODERRDEF( Bzip2, 0x300, "Bzip2 module" ) 109 | FT_MODERRDEF( Cache, 0x400, "cache module" ) 110 | FT_MODERRDEF( CFF, 0x500, "CFF module" ) 111 | FT_MODERRDEF( CID, 0x600, "CID module" ) 112 | FT_MODERRDEF( Gzip, 0x700, "Gzip module" ) 113 | FT_MODERRDEF( LZW, 0x800, "LZW module" ) 114 | FT_MODERRDEF( OTvalid, 0x900, "OpenType validation module" ) 115 | FT_MODERRDEF( PCF, 0xA00, "PCF module" ) 116 | FT_MODERRDEF( PFR, 0xB00, "PFR module" ) 117 | FT_MODERRDEF( PSaux, 0xC00, "PS auxiliary module" ) 118 | FT_MODERRDEF( PShinter, 0xD00, "PS hinter module" ) 119 | FT_MODERRDEF( PSnames, 0xE00, "PS names module" ) 120 | FT_MODERRDEF( Raster, 0xF00, "raster module" ) 121 | FT_MODERRDEF( SFNT, 0x1000, "SFNT module" ) 122 | FT_MODERRDEF( Smooth, 0x1100, "smooth raster module" ) 123 | FT_MODERRDEF( TrueType, 0x1200, "TrueType module" ) 124 | FT_MODERRDEF( Type1, 0x1300, "Type 1 module" ) 125 | FT_MODERRDEF( Type42, 0x1400, "Type 42 module" ) 126 | FT_MODERRDEF( Winfonts, 0x1500, "Windows FON/FNT module" ) 127 | 128 | 129 | #ifdef FT_MODERR_END_LIST 130 | FT_MODERR_END_LIST 131 | #endif 132 | 133 | 134 | /*******************************************************************/ 135 | /*******************************************************************/ 136 | /***** *****/ 137 | /***** CLEANUP *****/ 138 | /***** *****/ 139 | /*******************************************************************/ 140 | /*******************************************************************/ 141 | 142 | 143 | #ifdef FT_NEED_EXTERN_C 144 | } 145 | #endif 146 | 147 | #undef FT_MODERR_START_LIST 148 | #undef FT_MODERR_END_LIST 149 | #undef FT_MODERRDEF 150 | #undef FT_NEED_EXTERN_C 151 | 152 | 153 | #endif /* __FTMODERR_H__ */ 154 | 155 | 156 | /* END */ 157 | -------------------------------------------------------------------------------- /include/freetype2/freetype/ftlcdfil.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftlcdfil.h */ 4 | /* */ 5 | /* FreeType API for color filtering of subpixel bitmap glyphs */ 6 | /* (specification). */ 7 | /* */ 8 | /* Copyright 2006, 2007, 2008, 2010 by */ 9 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 10 | /* */ 11 | /* This file is part of the FreeType project, and may only be used, */ 12 | /* modified, and distributed under the terms of the FreeType project */ 13 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 14 | /* this file you indicate that you have read the license and */ 15 | /* understand and accept it fully. */ 16 | /* */ 17 | /***************************************************************************/ 18 | 19 | 20 | #ifndef __FT_LCD_FILTER_H__ 21 | #define __FT_LCD_FILTER_H__ 22 | 23 | #include <ft2build.h> 24 | #include FT_FREETYPE_H 25 | 26 | #ifdef FREETYPE_H 27 | #error "freetype.h of FreeType 1 has been loaded!" 28 | #error "Please fix the directory search order for header files" 29 | #error "so that freetype.h of FreeType 2 is found first." 30 | #endif 31 | 32 | 33 | FT_BEGIN_HEADER 34 | 35 | /*************************************************************************** 36 | * 37 | * @section: 38 | * lcd_filtering 39 | * 40 | * @title: 41 | * LCD Filtering 42 | * 43 | * @abstract: 44 | * Reduce color fringes of LCD-optimized bitmaps. 45 | * 46 | * @description: 47 | * The @FT_Library_SetLcdFilter API can be used to specify a low-pass 48 | * filter which is then applied to LCD-optimized bitmaps generated 49 | * through @FT_Render_Glyph. This is useful to reduce color fringes 50 | * which would occur with unfiltered rendering. 51 | * 52 | * Note that no filter is active by default, and that this function is 53 | * *not* implemented in default builds of the library. You need to 54 | * #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your `ftoption.h' file 55 | * in order to activate it. 56 | */ 57 | 58 | 59 | /**************************************************************************** 60 | * 61 | * @enum: 62 | * FT_LcdFilter 63 | * 64 | * @description: 65 | * A list of values to identify various types of LCD filters. 66 | * 67 | * @values: 68 | * FT_LCD_FILTER_NONE :: 69 | * Do not perform filtering. When used with subpixel rendering, this 70 | * results in sometimes severe color fringes. 71 | * 72 | * FT_LCD_FILTER_DEFAULT :: 73 | * The default filter reduces color fringes considerably, at the cost 74 | * of a slight blurriness in the output. 75 | * 76 | * FT_LCD_FILTER_LIGHT :: 77 | * The light filter is a variant that produces less blurriness at the 78 | * cost of slightly more color fringes than the default one. It might 79 | * be better, depending on taste, your monitor, or your personal vision. 80 | * 81 | * FT_LCD_FILTER_LEGACY :: 82 | * This filter corresponds to the original libXft color filter. It 83 | * provides high contrast output but can exhibit really bad color 84 | * fringes if glyphs are not extremely well hinted to the pixel grid. 85 | * In other words, it only works well if the TrueType bytecode 86 | * interpreter is enabled *and* high-quality hinted fonts are used. 87 | * 88 | * This filter is only provided for comparison purposes, and might be 89 | * disabled or stay unsupported in the future. 90 | * 91 | * @since: 92 | * 2.3.0 93 | */ 94 | typedef enum FT_LcdFilter_ 95 | { 96 | FT_LCD_FILTER_NONE = 0, 97 | FT_LCD_FILTER_DEFAULT = 1, 98 | FT_LCD_FILTER_LIGHT = 2, 99 | FT_LCD_FILTER_LEGACY = 16, 100 | 101 | FT_LCD_FILTER_MAX /* do not remove */ 102 | 103 | } FT_LcdFilter; 104 | 105 | 106 | /************************************************************************** 107 | * 108 | * @func: 109 | * FT_Library_SetLcdFilter 110 | * 111 | * @description: 112 | * This function is used to apply color filtering to LCD decimated 113 | * bitmaps, like the ones used when calling @FT_Render_Glyph with 114 | * @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V. 115 | * 116 | * @input: 117 | * library :: 118 | * A handle to the target library instance. 119 | * 120 | * filter :: 121 | * The filter type. 122 | * 123 | * You can use @FT_LCD_FILTER_NONE here to disable this feature, or 124 | * @FT_LCD_FILTER_DEFAULT to use a default filter that should work 125 | * well on most LCD screens. 126 | * 127 | * @return: 128 | * FreeType error code. 0~means success. 129 | * 130 | * @note: 131 | * This feature is always disabled by default. Clients must make an 132 | * explicit call to this function with a `filter' value other than 133 | * @FT_LCD_FILTER_NONE in order to enable it. 134 | * 135 | * Due to *PATENTS* covering subpixel rendering, this function doesn't 136 | * do anything except returning `FT_Err_Unimplemented_Feature' if the 137 | * configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not 138 | * defined in your build of the library, which should correspond to all 139 | * default builds of FreeType. 140 | * 141 | * The filter affects glyph bitmaps rendered through @FT_Render_Glyph, 142 | * @FT_Outline_Get_Bitmap, @FT_Load_Glyph, and @FT_Load_Char. 143 | * 144 | * It does _not_ affect the output of @FT_Outline_Render and 145 | * @FT_Outline_Get_Bitmap. 146 | * 147 | * If this feature is activated, the dimensions of LCD glyph bitmaps are 148 | * either larger or taller than the dimensions of the corresponding 149 | * outline with regards to the pixel grid. For example, for 150 | * @FT_RENDER_MODE_LCD, the filter adds up to 3~pixels to the left, and 151 | * up to 3~pixels to the right. 152 | * 153 | * The bitmap offset values are adjusted correctly, so clients shouldn't 154 | * need to modify their layout and glyph positioning code when enabling 155 | * the filter. 156 | * 157 | * @since: 158 | * 2.3.0 159 | */ 160 | FT_EXPORT( FT_Error ) 161 | FT_Library_SetLcdFilter( FT_Library library, 162 | FT_LcdFilter filter ); 163 | 164 | 165 | /************************************************************************** 166 | * 167 | * @func: 168 | * FT_Library_SetLcdFilterWeights 169 | * 170 | * @description: 171 | * Use this function to override the filter weights selected by 172 | * @FT_Library_SetLcdFilter. By default, FreeType uses the quintuple 173 | * (0x00, 0x55, 0x56, 0x55, 0x00) for FT_LCD_FILTER_LIGHT, and (0x10, 174 | * 0x40, 0x70, 0x40, 0x10) for FT_LCD_FILTER_DEFAULT and 175 | * FT_LCD_FILTER_LEGACY. 176 | * 177 | * @input: 178 | * library :: 179 | * A handle to the target library instance. 180 | * 181 | * weights :: 182 | * A pointer to an array; the function copies the first five bytes and 183 | * uses them to specify the filter weights. 184 | * 185 | * @return: 186 | * FreeType error code. 0~means success. 187 | * 188 | * @note: 189 | * Due to *PATENTS* covering subpixel rendering, this function doesn't 190 | * do anything except returning `FT_Err_Unimplemented_Feature' if the 191 | * configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not 192 | * defined in your build of the library, which should correspond to all 193 | * default builds of FreeType. 194 | * 195 | * This function must be called after @FT_Library_SetLcdFilter to have 196 | * any effect. 197 | * 198 | * @since: 199 | * 2.4.0 200 | */ 201 | FT_EXPORT( FT_Error ) 202 | FT_Library_SetLcdFilterWeights( FT_Library library, 203 | unsigned char *weights ); 204 | 205 | /* */ 206 | 207 | 208 | FT_END_HEADER 209 | 210 | #endif /* __FT_LCD_FILTER_H__ */ 211 | 212 | 213 | /* END */ 214 | -------------------------------------------------------------------------------- /include/freetype2/freetype/ftsizes.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftsizes.h */ 4 | /* */ 5 | /* FreeType size objects management (specification). */ 6 | /* */ 7 | /* Copyright 1996-2001, 2003, 2004, 2006, 2009 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 | /*************************************************************************/ 20 | /* */ 21 | /* Typical application would normally not need to use these functions. */ 22 | /* However, they have been placed in a public API for the rare cases */ 23 | /* where they are needed. */ 24 | /* */ 25 | /*************************************************************************/ 26 | 27 | 28 | #ifndef __FTSIZES_H__ 29 | #define __FTSIZES_H__ 30 | 31 | 32 | #include <ft2build.h> 33 | #include FT_FREETYPE_H 34 | 35 | #ifdef FREETYPE_H 36 | #error "freetype.h of FreeType 1 has been loaded!" 37 | #error "Please fix the directory search order for header files" 38 | #error "so that freetype.h of FreeType 2 is found first." 39 | #endif 40 | 41 | 42 | FT_BEGIN_HEADER 43 | 44 | 45 | /*************************************************************************/ 46 | /* */ 47 | /* <Section> */ 48 | /* sizes_management */ 49 | /* */ 50 | /* <Title> */ 51 | /* Size Management */ 52 | /* */ 53 | /* <Abstract> */ 54 | /* Managing multiple sizes per face. */ 55 | /* */ 56 | /* <Description> */ 57 | /* When creating a new face object (e.g., with @FT_New_Face), an */ 58 | /* @FT_Size object is automatically created and used to store all */ 59 | /* pixel-size dependent information, available in the `face->size' */ 60 | /* field. */ 61 | /* */ 62 | /* It is however possible to create more sizes for a given face, */ 63 | /* mostly in order to manage several character pixel sizes of the */ 64 | /* same font family and style. See @FT_New_Size and @FT_Done_Size. */ 65 | /* */ 66 | /* Note that @FT_Set_Pixel_Sizes and @FT_Set_Char_Size only */ 67 | /* modify the contents of the current `active' size; you thus need */ 68 | /* to use @FT_Activate_Size to change it. */ 69 | /* */ 70 | /* 99% of applications won't need the functions provided here, */ 71 | /* especially if they use the caching sub-system, so be cautious */ 72 | /* when using these. */ 73 | /* */ 74 | /*************************************************************************/ 75 | 76 | 77 | /*************************************************************************/ 78 | /* */ 79 | /* <Function> */ 80 | /* FT_New_Size */ 81 | /* */ 82 | /* <Description> */ 83 | /* Create a new size object from a given face object. */ 84 | /* */ 85 | /* <Input> */ 86 | /* face :: A handle to a parent face object. */ 87 | /* */ 88 | /* <Output> */ 89 | /* asize :: A handle to a new size object. */ 90 | /* */ 91 | /* <Return> */ 92 | /* FreeType error code. 0~means success. */ 93 | /* */ 94 | /* <Note> */ 95 | /* You need to call @FT_Activate_Size in order to select the new size */ 96 | /* for upcoming calls to @FT_Set_Pixel_Sizes, @FT_Set_Char_Size, */ 97 | /* @FT_Load_Glyph, @FT_Load_Char, etc. */ 98 | /* */ 99 | FT_EXPORT( FT_Error ) 100 | FT_New_Size( FT_Face face, 101 | FT_Size* size ); 102 | 103 | 104 | /*************************************************************************/ 105 | /* */ 106 | /* <Function> */ 107 | /* FT_Done_Size */ 108 | /* */ 109 | /* <Description> */ 110 | /* Discard a given size object. Note that @FT_Done_Face */ 111 | /* automatically discards all size objects allocated with */ 112 | /* @FT_New_Size. */ 113 | /* */ 114 | /* <Input> */ 115 | /* size :: A handle to a target size object. */ 116 | /* */ 117 | /* <Return> */ 118 | /* FreeType error code. 0~means success. */ 119 | /* */ 120 | FT_EXPORT( FT_Error ) 121 | FT_Done_Size( FT_Size size ); 122 | 123 | 124 | /*************************************************************************/ 125 | /* */ 126 | /* <Function> */ 127 | /* FT_Activate_Size */ 128 | /* */ 129 | /* <Description> */ 130 | /* Even though it is possible to create several size objects for a */ 131 | /* given face (see @FT_New_Size for details), functions like */ 132 | /* @FT_Load_Glyph or @FT_Load_Char only use the one which has been */ 133 | /* activated last to determine the `current character pixel size'. */ 134 | /* */ 135 | /* This function can be used to `activate' a previously created size */ 136 | /* object. */ 137 | /* */ 138 | /* <Input> */ 139 | /* size :: A handle to a target size object. */ 140 | /* */ 141 | /* <Return> */ 142 | /* FreeType error code. 0~means success. */ 143 | /* */ 144 | /* <Note> */ 145 | /* If `face' is the size's parent face object, this function changes */ 146 | /* the value of `face->size' to the input size handle. */ 147 | /* */ 148 | FT_EXPORT( FT_Error ) 149 | FT_Activate_Size( FT_Size size ); 150 | 151 | /* */ 152 | 153 | 154 | FT_END_HEADER 155 | 156 | #endif /* __FTSIZES_H__ */ 157 | 158 | 159 | /* END */ 160 | -------------------------------------------------------------------------------- /include/freetype2/freetype/fttrigon.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* fttrigon.h */ 4 | /* */ 5 | /* FreeType trigonometric functions (specification). */ 6 | /* */ 7 | /* Copyright 2001, 2003, 2005, 2007 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 __FTTRIGON_H__ 20 | #define __FTTRIGON_H__ 21 | 22 | #include FT_FREETYPE_H 23 | 24 | #ifdef FREETYPE_H 25 | #error "freetype.h of FreeType 1 has been loaded!" 26 | #error "Please fix the directory search order for header files" 27 | #error "so that freetype.h of FreeType 2 is found first." 28 | #endif 29 | 30 | 31 | FT_BEGIN_HEADER 32 | 33 | 34 | /*************************************************************************/ 35 | /* */ 36 | /* <Section> */ 37 | /* computations */ 38 | /* */ 39 | /*************************************************************************/ 40 | 41 | 42 | /************************************************************************* 43 | * 44 | * @type: 45 | * FT_Angle 46 | * 47 | * @description: 48 | * This type is used to model angle values in FreeType. Note that the 49 | * angle is a 16.16 fixed float value expressed in degrees. 50 | * 51 | */ 52 | typedef FT_Fixed FT_Angle; 53 | 54 | 55 | /************************************************************************* 56 | * 57 | * @macro: 58 | * FT_ANGLE_PI 59 | * 60 | * @description: 61 | * The angle pi expressed in @FT_Angle units. 62 | * 63 | */ 64 | #define FT_ANGLE_PI ( 180L << 16 ) 65 | 66 | 67 | /************************************************************************* 68 | * 69 | * @macro: 70 | * FT_ANGLE_2PI 71 | * 72 | * @description: 73 | * The angle 2*pi expressed in @FT_Angle units. 74 | * 75 | */ 76 | #define FT_ANGLE_2PI ( FT_ANGLE_PI * 2 ) 77 | 78 | 79 | /************************************************************************* 80 | * 81 | * @macro: 82 | * FT_ANGLE_PI2 83 | * 84 | * @description: 85 | * The angle pi/2 expressed in @FT_Angle units. 86 | * 87 | */ 88 | #define FT_ANGLE_PI2 ( FT_ANGLE_PI / 2 ) 89 | 90 | 91 | /************************************************************************* 92 | * 93 | * @macro: 94 | * FT_ANGLE_PI4 95 | * 96 | * @description: 97 | * The angle pi/4 expressed in @FT_Angle units. 98 | * 99 | */ 100 | #define FT_ANGLE_PI4 ( FT_ANGLE_PI / 4 ) 101 | 102 | 103 | /************************************************************************* 104 | * 105 | * @function: 106 | * FT_Sin 107 | * 108 | * @description: 109 | * Return the sinus of a given angle in fixed point format. 110 | * 111 | * @input: 112 | * angle :: 113 | * The input angle. 114 | * 115 | * @return: 116 | * The sinus value. 117 | * 118 | * @note: 119 | * If you need both the sinus and cosinus for a given angle, use the 120 | * function @FT_Vector_Unit. 121 | * 122 | */ 123 | FT_EXPORT( FT_Fixed ) 124 | FT_Sin( FT_Angle angle ); 125 | 126 | 127 | /************************************************************************* 128 | * 129 | * @function: 130 | * FT_Cos 131 | * 132 | * @description: 133 | * Return the cosinus of a given angle in fixed point format. 134 | * 135 | * @input: 136 | * angle :: 137 | * The input angle. 138 | * 139 | * @return: 140 | * The cosinus value. 141 | * 142 | * @note: 143 | * If you need both the sinus and cosinus for a given angle, use the 144 | * function @FT_Vector_Unit. 145 | * 146 | */ 147 | FT_EXPORT( FT_Fixed ) 148 | FT_Cos( FT_Angle angle ); 149 | 150 | 151 | /************************************************************************* 152 | * 153 | * @function: 154 | * FT_Tan 155 | * 156 | * @description: 157 | * Return the tangent of a given angle in fixed point format. 158 | * 159 | * @input: 160 | * angle :: 161 | * The input angle. 162 | * 163 | * @return: 164 | * The tangent value. 165 | * 166 | */ 167 | FT_EXPORT( FT_Fixed ) 168 | FT_Tan( FT_Angle angle ); 169 | 170 | 171 | /************************************************************************* 172 | * 173 | * @function: 174 | * FT_Atan2 175 | * 176 | * @description: 177 | * Return the arc-tangent corresponding to a given vector (x,y) in 178 | * the 2d plane. 179 | * 180 | * @input: 181 | * x :: 182 | * The horizontal vector coordinate. 183 | * 184 | * y :: 185 | * The vertical vector coordinate. 186 | * 187 | * @return: 188 | * The arc-tangent value (i.e. angle). 189 | * 190 | */ 191 | FT_EXPORT( FT_Angle ) 192 | FT_Atan2( FT_Fixed x, 193 | FT_Fixed y ); 194 | 195 | 196 | /************************************************************************* 197 | * 198 | * @function: 199 | * FT_Angle_Diff 200 | * 201 | * @description: 202 | * Return the difference between two angles. The result is always 203 | * constrained to the ]-PI..PI] interval. 204 | * 205 | * @input: 206 | * angle1 :: 207 | * First angle. 208 | * 209 | * angle2 :: 210 | * Second angle. 211 | * 212 | * @return: 213 | * Constrained value of `value2-value1'. 214 | * 215 | */ 216 | FT_EXPORT( FT_Angle ) 217 | FT_Angle_Diff( FT_Angle angle1, 218 | FT_Angle angle2 ); 219 | 220 | 221 | /************************************************************************* 222 | * 223 | * @function: 224 | * FT_Vector_Unit 225 | * 226 | * @description: 227 | * Return the unit vector corresponding to a given angle. After the 228 | * call, the value of `vec.x' will be `sin(angle)', and the value of 229 | * `vec.y' will be `cos(angle)'. 230 | * 231 | * This function is useful to retrieve both the sinus and cosinus of a 232 | * given angle quickly. 233 | * 234 | * @output: 235 | * vec :: 236 | * The address of target vector. 237 | * 238 | * @input: 239 | * angle :: 240 | * The address of angle. 241 | * 242 | */ 243 | FT_EXPORT( void ) 244 | FT_Vector_Unit( FT_Vector* vec, 245 | FT_Angle angle ); 246 | 247 | 248 | /************************************************************************* 249 | * 250 | * @function: 251 | * FT_Vector_Rotate 252 | * 253 | * @description: 254 | * Rotate a vector by a given angle. 255 | * 256 | * @inout: 257 | * vec :: 258 | * The address of target vector. 259 | * 260 | * @input: 261 | * angle :: 262 | * The address of angle. 263 | * 264 | */ 265 | FT_EXPORT( void ) 266 | FT_Vector_Rotate( FT_Vector* vec, 267 | FT_Angle angle ); 268 | 269 | 270 | /************************************************************************* 271 | * 272 | * @function: 273 | * FT_Vector_Length 274 | * 275 | * @description: 276 | * Return the length of a given vector. 277 | * 278 | * @input: 279 | * vec :: 280 | * The address of target vector. 281 | * 282 | * @return: 283 | * The vector length, expressed in the same units that the original 284 | * vector coordinates. 285 | * 286 | */ 287 | FT_EXPORT( FT_Fixed ) 288 | FT_Vector_Length( FT_Vector* vec ); 289 | 290 | 291 | /************************************************************************* 292 | * 293 | * @function: 294 | * FT_Vector_Polarize 295 | * 296 | * @description: 297 | * Compute both the length and angle of a given vector. 298 | * 299 | * @input: 300 | * vec :: 301 | * The address of source vector. 302 | * 303 | * @output: 304 | * length :: 305 | * The vector length. 306 | * 307 | * angle :: 308 | * The vector angle. 309 | * 310 | */ 311 | FT_EXPORT( void ) 312 | FT_Vector_Polarize( FT_Vector* vec, 313 | FT_Fixed *length, 314 | FT_Angle *angle ); 315 | 316 | 317 | /************************************************************************* 318 | * 319 | * @function: 320 | * FT_Vector_From_Polar 321 | * 322 | * @description: 323 | * Compute vector coordinates from a length and angle. 324 | * 325 | * @output: 326 | * vec :: 327 | * The address of source vector. 328 | * 329 | * @input: 330 | * length :: 331 | * The vector length. 332 | * 333 | * angle :: 334 | * The vector angle. 335 | * 336 | */ 337 | FT_EXPORT( void ) 338 | FT_Vector_From_Polar( FT_Vector* vec, 339 | FT_Fixed length, 340 | FT_Angle angle ); 341 | 342 | /* */ 343 | 344 | 345 | FT_END_HEADER 346 | 347 | #endif /* __FTTRIGON_H__ */ 348 | 349 | 350 | /* END */ 351 | -------------------------------------------------------------------------------- /device.c: -------------------------------------------------------------------------------- 1 | /* 2 | * fbtruetype-android 3 | * 4 | * (c) 2015 by Michael Higham, <mhigham1986@gmail.com> 5 | * 6 | * This program is based on fbtruetype, written and (C) by 7 | * (c) 2001-2002 by Stefan Reinauer, <stepan@suse.de> 8 | * 9 | * This program my be redistributed under the terms of the 10 | * GNU General Public Licence, version 2, or at your preference, 11 | * any later version. 12 | */ 13 | 14 | #include <stdio.h> 15 | #include <stdlib.h> 16 | #include <stdint.h> 17 | #include <unistd.h> 18 | #include <fcntl.h> 19 | #include <errno.h> 20 | #include <string.h> 21 | #include <regex.h> 22 | #include <linux/input.h> 23 | #include <linux/fb.h> 24 | #include <linux/kd.h> 25 | #include <linux/vt.h> 26 | #include <sys/ioctl.h> 27 | #include <unistd.h> 28 | 29 | #include "device.h" 30 | 31 | int fb; 32 | 33 | char *regexp (char *string, char *patrn, int *begin, int *end) { 34 | int i, w=0, len; 35 | char *word = NULL; 36 | regex_t rgT; 37 | regmatch_t match; 38 | regcomp(&rgT,patrn,REG_EXTENDED); 39 | if ((regexec(&rgT,string,1,&match,0)) == 0) { 40 | *begin = (int)match.rm_so; 41 | *end = (int)match.rm_eo; 42 | len = *end-*begin; 43 | word=malloc(len+1); 44 | for (i=*begin; i<*end; i++) { 45 | word[w] = string[i]; 46 | w++; } 47 | word[w]=0; 48 | } 49 | regfree(&rgT); 50 | return word; 51 | } 52 | 53 | void clear_display(void) 54 | { 55 | int fb = open("/dev/graphics/fb0", O_WRONLY); 56 | if (fb < 0) { 57 | printf("Error opening framebuffer on device.\n"); 58 | exit(0); 59 | } 60 | 61 | // Write 0's all over the framebuffer, in chunks of 512 bytes. 62 | char* zeros = calloc(1, 512); 63 | ssize_t written, total = 0; 64 | do { 65 | total += written = write(fb, zeros, 512); 66 | } while (written == 512); 67 | 68 | close(fb); 69 | free(zeros); 70 | } 71 | 72 | void power_key(void) 73 | { 74 | // Send short press power key 75 | FILE *devfile; 76 | int fd; 77 | int b,e; 78 | long s = 0; 79 | ssize_t ret; 80 | char *devstr; 81 | char *matchblock; 82 | char *eventres; 83 | char eventstr[20]; 84 | struct input_event event1; 85 | struct input_event event2; 86 | struct input_event event3; 87 | struct input_event event4; 88 | 89 | if((devfile = fopen("/proc/bus/input/devices", "rb")) == NULL) { 90 | printf("Error reading devices file!\n"); 91 | exit(0); 92 | } else { 93 | devfile = fopen("/proc/bus/input/devices", "rb"); 94 | if ( devfile != NULL ) { 95 | while (getc(devfile) != EOF) { 96 | s++; 97 | } 98 | rewind(devfile); 99 | devstr = malloc(s); 100 | if ( devstr != NULL ) { 101 | fread(devstr, s, 1, devfile); 102 | fclose(devfile); 103 | devfile = NULL; 104 | //printf("%s\n",devstr); 105 | 106 | if((matchblock = regexp(devstr,"event[0-9]*[A-z0-9 ]*(\n)B:[ ]*PROP=[A-z0-9]*(\n)B:[ ]*EV=[A-z0-9]*(\n)B:[ ]*KEY=[0-9 ]*1c0[0-9]00 ",&b,&e)) != NULL) { 107 | matchblock = regexp(devstr,"event[0-9]*[A-z0-9 ]*(\n)B:[ ]*PROP=[A-z0-9]*(\n)B:[ ]*EV=[A-z0-9]*(\n)B:[ ]*KEY=[0-9 ]*1c0[0-9]00 ",&b,&e); 108 | } else if((matchblock = regexp(devstr,"event[0-9]*[A-z0-9 ]*(\n)B:[ ]*EV=[A-z0-9]*(\n)B:[ ]*KEY=[0-9 ]*1c0[0-9]00 ",&b,&e)) != NULL) { 109 | matchblock = regexp(devstr,"event[0-9]*[A-z0-9 ]*(\n)B:[ ]*EV=[A-z0-9]*(\n)B:[ ]*KEY=[0-9 ]*1c0[0-9]00 ",&b,&e); 110 | } else { 111 | printf("Error finding input device!\n"); 112 | exit(0); 113 | } 114 | 115 | if((eventres = regexp(matchblock,"event[0-9]*",&b,&e)) != NULL) { 116 | eventres = regexp(matchblock,"event[0-9]*",&b,&e); 117 | snprintf(eventstr, sizeof eventstr, "%s%s", "/dev/input/", eventres); 118 | } else { 119 | printf("Error finding input event number!\n"); 120 | exit(0); 121 | } 122 | free(devstr); 123 | } 124 | } 125 | if (devfile != NULL) { 126 | fclose(devfile); 127 | } 128 | } 129 | 130 | //printf("Input device = %s\n", eventstr); 131 | 132 | fd = open(eventstr, O_RDWR); 133 | if(fd < 0) { 134 | printf("Error reading input device!\n"); 135 | exit(0); 136 | } 137 | 138 | memset(&event1, 0, sizeof(event1)); 139 | event1.type = 1; 140 | event1.code = 116; 141 | event1.value = 1; 142 | ret = write(fd, &event1, sizeof(event1)); 143 | if(ret < (ssize_t) sizeof(event1)) { 144 | printf("Error writing to event!\n"); 145 | exit(0); 146 | } 147 | 148 | memset(&event2, 0, sizeof(event2)); 149 | event2.type = 0; 150 | event2.code = 0; 151 | event2.value = 0; 152 | ret = write(fd, &event2, sizeof(event2)); 153 | if(ret < (ssize_t) sizeof(event2)) { 154 | printf("Error writing to event!\n"); 155 | exit(0); 156 | } 157 | 158 | memset(&event3, 0, sizeof(event3)); 159 | event3.type = 1; 160 | event3.code = 116; 161 | event3.value = 0; 162 | ret = write(fd, &event3, sizeof(event3)); 163 | if(ret < (ssize_t) sizeof(event3)) { 164 | printf("Error writing to event!\n"); 165 | exit(0); 166 | } 167 | 168 | memset(&event4, 0, sizeof(event4)); 169 | event4.type = 0; 170 | event4.code = 0; 171 | event4.value = 0; 172 | ret = write(fd, &event4, sizeof(event4)); 173 | if(ret < (ssize_t) sizeof(event4)) { 174 | printf("Error writing to event!\n"); 175 | exit(0); 176 | } 177 | } 178 | 179 | void power_status(void) 180 | { 181 | char power_status[3]; 182 | FILE *pwr_stat; 183 | 184 | // Get the display power state 185 | if( access("/sys/power/wait_for_fb_status", F_OK ) != -1 && access("/sys/power/wait_for_fb_status", R_OK) != -1 ) { 186 | pwr_stat = fopen("/sys/power/wait_for_fb_status","r"); 187 | fscanf(pwr_stat, "%s", power_status); 188 | fclose(pwr_stat); 189 | 190 | } else { 191 | printf("Unable to get display power status!\n"); 192 | fclose(pwr_stat); 193 | exit(0); 194 | } 195 | } 196 | 197 | void display_info(void) 198 | { 199 | int *xres; 200 | int *yres; 201 | char power_status[3]; 202 | static struct fb_var_screeninfo var; 203 | FILE *pwr_stat; 204 | 205 | // Get the display power status 206 | pwr_stat = fopen("/sys/power/wait_for_fb_status","r"); 207 | 208 | if( access("/sys/power/wait_for_fb_status", F_OK ) != -1 && access("/sys/power/wait_for_fb_status", R_OK) != -1 ) { 209 | fscanf(pwr_stat, "%s", power_status); 210 | fclose(pwr_stat); 211 | } else { 212 | printf("Unable to get display power status!\n"); 213 | fclose(pwr_stat); 214 | exit(0); 215 | } 216 | 217 | // Get display resolution information 218 | fb = open("/dev/graphics/fb0", O_RDWR); 219 | if (fb == -1) { 220 | printf("Error opening display!\n"); 221 | exit(0); 222 | } 223 | 224 | if (ioctl(fb, FBIOGET_VSCREENINFO, &var) < 0) { 225 | printf("Error probing display information!\n"); 226 | close(fb); 227 | exit(0); 228 | } 229 | close(fb); 230 | 231 | printf("------------------------------\n"); 232 | printf("Display:\tfb0\n"); 233 | printf("------------------------------\n"); 234 | printf("Resolution:\t%dx%d\n", var.xres, var.yres); 235 | printf("BPP:\t\t%d\n", var.bits_per_pixel); 236 | printf("Power state:\t%s\n", power_status); 237 | printf("------------------------------\n"); 238 | } 239 | 240 | void power_display(void) 241 | { 242 | // Set the display power state to on 243 | FILE *power_set; 244 | if( access("/sys/power/state", F_OK ) != -1 && access("/sys/power/state", R_OK) != -1 ) { 245 | power_set=fopen("/sys/power/state", "w+"); 246 | char on[2]="on"; 247 | fwrite(on, sizeof(on[0]), sizeof(on)/sizeof(on[0]), power_set); 248 | fclose(power_set); 249 | } else { 250 | fprintf(stderr, "Unable to set display power state!\n"); 251 | exit(1); 252 | } 253 | } 254 | 255 | void set_brightness(int brightness, int blen) 256 | { 257 | char max[(blen)]; 258 | sprintf(max, "%d", brightness); 259 | 260 | // Set the display brightness 261 | FILE *brightness_set; 262 | if( access("/sys/class/backlight/panel/brightness", F_OK ) != -1 && access("/sys/class/backlight/panel/brightness", R_OK ) != -1 ) { 263 | brightness_set=fopen("/sys/class/backlight/panel/brightness", "w+"); 264 | fwrite(max, sizeof(max[0]), sizeof(max)/sizeof(max[0]), brightness_set); 265 | fclose(brightness_set); 266 | } else if( access("/sys/class/leds/lcd-backlight/brightness", F_OK ) != -1 && access("/sys/class/leds/lcd-backlight/brightness", R_OK ) != -1 ) { 267 | brightness_set=fopen("/sys/class/leds/lcd-backlight/brightness", "w+"); 268 | fwrite(max, sizeof(max[0]), sizeof(max)/sizeof(max[0]), brightness_set); 269 | fclose(brightness_set); 270 | } else { 271 | printf("Unable to set display brightness!\n"); 272 | exit(1); 273 | } 274 | } 275 | 276 | void wait_sleep() 277 | { 278 | char sleep_status[8]; 279 | FILE *sleep_stat; 280 | 281 | // Wait for the display to sleep 282 | if (access("/sys/power/wait_for_fb_sleep", F_OK ) != -1 && access("/sys/power/wait_for_fb_sleep", R_OK) != -1) { 283 | sleep_stat = fopen("/sys/power/wait_for_fb_sleep","r"); 284 | fscanf(sleep_stat, "%s", sleep_status); 285 | fclose(sleep_stat); 286 | 287 | // Loop to check sleep status 288 | while (strcmp(sleep_status, "sleeping") != 0) { 289 | sleep_stat = fopen("/sys/power/wait_for_fb_sleep","r"); 290 | fscanf(sleep_stat, "%s", sleep_status); 291 | fclose(sleep_stat); 292 | } 293 | } else { 294 | printf("Unable to get sleep status!\n"); 295 | } 296 | } 297 | 298 | void wait_wake() 299 | { 300 | char wake_status[5]; 301 | FILE *wake_stat; 302 | 303 | // Wait for the display to wake up 304 | if (access("/sys/power/wait_for_fb_wake", F_OK ) != -1 && access("/sys/power/wait_for_fb_wake", R_OK) != -1) { 305 | wake_stat = fopen("/sys/power/wait_for_fb_wake","r"); 306 | fscanf(wake_stat, "%s", wake_status); 307 | fclose(wake_stat); 308 | 309 | // Loop to check wake status 310 | while (strcmp(wake_status, "awake") != 0) { 311 | wake_stat = fopen("/sys/power/wait_for_fb_wake","r"); 312 | fscanf(wake_stat, "%s", wake_status); 313 | fclose(wake_stat); 314 | } 315 | 316 | // Pause to let display initialize 317 | sleep(1.5); 318 | 319 | } else { 320 | printf("Unable to get wake status!\n"); 321 | } 322 | } 323 | -------------------------------------------------------------------------------- /include/freetype2/freetype/fterrors.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* fterrors.h */ 4 | /* */ 5 | /* FreeType error code handling (specification). */ 6 | /* */ 7 | /* Copyright 1996-2001, 2002, 2004, 2007 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 | /*************************************************************************/ 20 | /* */ 21 | /* This special header file is used to define the handling of FT2 */ 22 | /* enumeration constants. It can also be used to generate error message */ 23 | /* strings with a small macro trick explained below. */ 24 | /* */ 25 | /* I - Error Formats */ 26 | /* ----------------- */ 27 | /* */ 28 | /* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */ 29 | /* defined in ftoption.h in order to make the higher byte indicate */ 30 | /* the module where the error has happened (this is not compatible */ 31 | /* with standard builds of FreeType 2). You can then use the macro */ 32 | /* FT_ERROR_BASE macro to extract the generic error code from an */ 33 | /* FT_Error value. */ 34 | /* */ 35 | /* */ 36 | /* II - Error Message strings */ 37 | /* -------------------------- */ 38 | /* */ 39 | /* The error definitions below are made through special macros that */ 40 | /* allow client applications to build a table of error message strings */ 41 | /* if they need it. The strings are not included in a normal build of */ 42 | /* FreeType 2 to save space (most client applications do not use */ 43 | /* them). */ 44 | /* */ 45 | /* To do so, you have to define the following macros before including */ 46 | /* this file: */ 47 | /* */ 48 | /* FT_ERROR_START_LIST :: */ 49 | /* This macro is called before anything else to define the start of */ 50 | /* the error list. It is followed by several FT_ERROR_DEF calls */ 51 | /* (see below). */ 52 | /* */ 53 | /* FT_ERROR_DEF( e, v, s ) :: */ 54 | /* This macro is called to define one single error. */ 55 | /* `e' is the error code identifier (e.g. FT_Err_Invalid_Argument). */ 56 | /* `v' is the error numerical value. */ 57 | /* `s' is the corresponding error string. */ 58 | /* */ 59 | /* FT_ERROR_END_LIST :: */ 60 | /* This macro ends the list. */ 61 | /* */ 62 | /* Additionally, you have to undefine __FTERRORS_H__ before #including */ 63 | /* this file. */ 64 | /* */ 65 | /* Here is a simple example: */ 66 | /* */ 67 | /* { */ 68 | /* #undef __FTERRORS_H__ */ 69 | /* #define FT_ERRORDEF( e, v, s ) { e, s }, */ 70 | /* #define FT_ERROR_START_LIST { */ 71 | /* #define FT_ERROR_END_LIST { 0, 0 } }; */ 72 | /* */ 73 | /* const struct */ 74 | /* { */ 75 | /* int err_code; */ 76 | /* const char* err_msg; */ 77 | /* } ft_errors[] = */ 78 | /* */ 79 | /* #include FT_ERRORS_H */ 80 | /* } */ 81 | /* */ 82 | /*************************************************************************/ 83 | 84 | 85 | #ifndef __FTERRORS_H__ 86 | #define __FTERRORS_H__ 87 | 88 | 89 | /* include module base error codes */ 90 | #include FT_MODULE_ERRORS_H 91 | 92 | 93 | /*******************************************************************/ 94 | /*******************************************************************/ 95 | /***** *****/ 96 | /***** SETUP MACROS *****/ 97 | /***** *****/ 98 | /*******************************************************************/ 99 | /*******************************************************************/ 100 | 101 | 102 | #undef FT_NEED_EXTERN_C 103 | 104 | #undef FT_ERR_XCAT 105 | #undef FT_ERR_CAT 106 | 107 | #define FT_ERR_XCAT( x, y ) x ## y 108 | #define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y ) 109 | 110 | 111 | /* FT_ERR_PREFIX is used as a prefix for error identifiers. */ 112 | /* By default, we use `FT_Err_'. */ 113 | /* */ 114 | #ifndef FT_ERR_PREFIX 115 | #define FT_ERR_PREFIX FT_Err_ 116 | #endif 117 | 118 | 119 | /* FT_ERR_BASE is used as the base for module-specific errors. */ 120 | /* */ 121 | #ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS 122 | 123 | #ifndef FT_ERR_BASE 124 | #define FT_ERR_BASE FT_Mod_Err_Base 125 | #endif 126 | 127 | #else 128 | 129 | #undef FT_ERR_BASE 130 | #define FT_ERR_BASE 0 131 | 132 | #endif /* FT_CONFIG_OPTION_USE_MODULE_ERRORS */ 133 | 134 | 135 | /* If FT_ERRORDEF is not defined, we need to define a simple */ 136 | /* enumeration type. */ 137 | /* */ 138 | #ifndef FT_ERRORDEF 139 | 140 | #define FT_ERRORDEF( e, v, s ) e = v, 141 | #define FT_ERROR_START_LIST enum { 142 | #define FT_ERROR_END_LIST FT_ERR_CAT( FT_ERR_PREFIX, Max ) }; 143 | 144 | #ifdef __cplusplus 145 | #define FT_NEED_EXTERN_C 146 | extern "C" { 147 | #endif 148 | 149 | #endif /* !FT_ERRORDEF */ 150 | 151 | 152 | /* this macro is used to define an error */ 153 | #define FT_ERRORDEF_( e, v, s ) \ 154 | FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s ) 155 | 156 | /* this is only used for <module>_Err_Ok, which must be 0! */ 157 | #define FT_NOERRORDEF_( e, v, s ) \ 158 | FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s ) 159 | 160 | 161 | #ifdef FT_ERROR_START_LIST 162 | FT_ERROR_START_LIST 163 | #endif 164 | 165 | 166 | /* now include the error codes */ 167 | #include FT_ERROR_DEFINITIONS_H 168 | 169 | 170 | #ifdef FT_ERROR_END_LIST 171 | FT_ERROR_END_LIST 172 | #endif 173 | 174 | 175 | /*******************************************************************/ 176 | /*******************************************************************/ 177 | /***** *****/ 178 | /***** SIMPLE CLEANUP *****/ 179 | /***** *****/ 180 | /*******************************************************************/ 181 | /*******************************************************************/ 182 | 183 | #ifdef FT_NEED_EXTERN_C 184 | } 185 | #endif 186 | 187 | #undef FT_ERROR_START_LIST 188 | #undef FT_ERROR_END_LIST 189 | 190 | #undef FT_ERRORDEF 191 | #undef FT_ERRORDEF_ 192 | #undef FT_NOERRORDEF_ 193 | 194 | #undef FT_NEED_EXTERN_C 195 | #undef FT_ERR_BASE 196 | 197 | /* FT_KEEP_ERR_PREFIX is needed for ftvalid.h */ 198 | #ifndef FT_KEEP_ERR_PREFIX 199 | #undef FT_ERR_PREFIX 200 | #else 201 | #undef FT_KEEP_ERR_PREFIX 202 | #endif 203 | 204 | #endif /* __FTERRORS_H__ */ 205 | 206 | 207 | /* END */ 208 | -------------------------------------------------------------------------------- /include/freetype2/freetype/ftadvanc.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftadvanc.h */ 4 | /* */ 5 | /* Quick computation of advance widths (specification only). */ 6 | /* */ 7 | /* Copyright 2008 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 __FTADVANC_H__ 20 | #define __FTADVANC_H__ 21 | 22 | 23 | #include <ft2build.h> 24 | #include FT_FREETYPE_H 25 | 26 | #ifdef FREETYPE_H 27 | #error "freetype.h of FreeType 1 has been loaded!" 28 | #error "Please fix the directory search order for header files" 29 | #error "so that freetype.h of FreeType 2 is found first." 30 | #endif 31 | 32 | 33 | FT_BEGIN_HEADER 34 | 35 | 36 | /************************************************************************** 37 | * 38 | * @section: 39 | * quick_advance 40 | * 41 | * @title: 42 | * Quick retrieval of advance values 43 | * 44 | * @abstract: 45 | * Retrieve horizontal and vertical advance values without processing 46 | * glyph outlines, if possible. 47 | * 48 | * @description: 49 | * This section contains functions to quickly extract advance values 50 | * without handling glyph outlines, if possible. 51 | */ 52 | 53 | 54 | /*************************************************************************/ 55 | /* */ 56 | /* <Const> */ 57 | /* FT_ADVANCE_FLAG_FAST_ONLY */ 58 | /* */ 59 | /* <Description> */ 60 | /* A bit-flag to be OR-ed with the `flags' parameter of the */ 61 | /* @FT_Get_Advance and @FT_Get_Advances functions. */ 62 | /* */ 63 | /* If set, it indicates that you want these functions to fail if the */ 64 | /* corresponding hinting mode or font driver doesn't allow for very */ 65 | /* quick advance computation. */ 66 | /* */ 67 | /* Typically, glyphs which are either unscaled, unhinted, bitmapped, */ 68 | /* or light-hinted can have their advance width computed very */ 69 | /* quickly. */ 70 | /* */ 71 | /* Normal and bytecode hinted modes, which require loading, scaling, */ 72 | /* and hinting of the glyph outline, are extremely slow by */ 73 | /* comparison. */ 74 | /* */ 75 | #define FT_ADVANCE_FLAG_FAST_ONLY 0x20000000UL 76 | 77 | 78 | /*************************************************************************/ 79 | /* */ 80 | /* <Function> */ 81 | /* FT_Get_Advance */ 82 | /* */ 83 | /* <Description> */ 84 | /* Retrieve the advance value of a given glyph outline in an */ 85 | /* @FT_Face. By default, the unhinted advance is returned in font */ 86 | /* units. */ 87 | /* */ 88 | /* <Input> */ 89 | /* face :: The source @FT_Face handle. */ 90 | /* */ 91 | /* gindex :: The glyph index. */ 92 | /* */ 93 | /* load_flags :: A set of bit flags similar to those used when */ 94 | /* calling @FT_Load_Glyph, used to determine what kind */ 95 | /* of advances you need. */ 96 | /* <Output> */ 97 | /* padvance :: The advance value, in either font units or 16.16 */ 98 | /* format. */ 99 | /* */ 100 | /* If @FT_LOAD_VERTICAL_LAYOUT is set, this is the */ 101 | /* vertical advance corresponding to a vertical layout. */ 102 | /* Otherwise, it is the horizontal advance in a */ 103 | /* horizontal layout. */ 104 | /* */ 105 | /* <Return> */ 106 | /* FreeType error code. 0 means success. */ 107 | /* */ 108 | /* <Note> */ 109 | /* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */ 110 | /* if the corresponding font backend doesn't have a quick way to */ 111 | /* retrieve the advances. */ 112 | /* */ 113 | /* A scaled advance is returned in 16.16 format but isn't transformed */ 114 | /* by the affine transformation specified by @FT_Set_Transform. */ 115 | /* */ 116 | FT_EXPORT( FT_Error ) 117 | FT_Get_Advance( FT_Face face, 118 | FT_UInt gindex, 119 | FT_Int32 load_flags, 120 | FT_Fixed *padvance ); 121 | 122 | 123 | /*************************************************************************/ 124 | /* */ 125 | /* <Function> */ 126 | /* FT_Get_Advances */ 127 | /* */ 128 | /* <Description> */ 129 | /* Retrieve the advance values of several glyph outlines in an */ 130 | /* @FT_Face. By default, the unhinted advances are returned in font */ 131 | /* units. */ 132 | /* */ 133 | /* <Input> */ 134 | /* face :: The source @FT_Face handle. */ 135 | /* */ 136 | /* start :: The first glyph index. */ 137 | /* */ 138 | /* count :: The number of advance values you want to retrieve. */ 139 | /* */ 140 | /* load_flags :: A set of bit flags similar to those used when */ 141 | /* calling @FT_Load_Glyph. */ 142 | /* */ 143 | /* <Output> */ 144 | /* padvance :: The advances, in either font units or 16.16 format. */ 145 | /* This array must contain at least `count' elements. */ 146 | /* */ 147 | /* If @FT_LOAD_VERTICAL_LAYOUT is set, these are the */ 148 | /* vertical advances corresponding to a vertical layout. */ 149 | /* Otherwise, they are the horizontal advances in a */ 150 | /* horizontal layout. */ 151 | /* */ 152 | /* <Return> */ 153 | /* FreeType error code. 0 means success. */ 154 | /* */ 155 | /* <Note> */ 156 | /* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */ 157 | /* if the corresponding font backend doesn't have a quick way to */ 158 | /* retrieve the advances. */ 159 | /* */ 160 | /* Scaled advances are returned in 16.16 format but aren't */ 161 | /* transformed by the affine transformation specified by */ 162 | /* @FT_Set_Transform. */ 163 | /* */ 164 | FT_EXPORT( FT_Error ) 165 | FT_Get_Advances( FT_Face face, 166 | FT_UInt start, 167 | FT_UInt count, 168 | FT_Int32 load_flags, 169 | FT_Fixed *padvances ); 170 | 171 | /* */ 172 | 173 | 174 | FT_END_HEADER 175 | 176 | #endif /* __FTADVANC_H__ */ 177 | 178 | 179 | /* END */ 180 | -------------------------------------------------------------------------------- /include/freetype2/freetype/ftwinfnt.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftwinfnt.h */ 4 | /* */ 5 | /* FreeType API for accessing Windows fnt-specific data. */ 6 | /* */ 7 | /* Copyright 2003, 2004, 2008 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 __FTWINFNT_H__ 20 | #define __FTWINFNT_H__ 21 | 22 | #include <ft2build.h> 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | 35 | /*************************************************************************/ 36 | /* */ 37 | /* <Section> */ 38 | /* winfnt_fonts */ 39 | /* */ 40 | /* <Title> */ 41 | /* Window FNT Files */ 42 | /* */ 43 | /* <Abstract> */ 44 | /* Windows FNT specific API. */ 45 | /* */ 46 | /* <Description> */ 47 | /* This section contains the declaration of Windows FNT specific */ 48 | /* functions. */ 49 | /* */ 50 | /*************************************************************************/ 51 | 52 | 53 | /************************************************************************* 54 | * 55 | * @enum: 56 | * FT_WinFNT_ID_XXX 57 | * 58 | * @description: 59 | * A list of valid values for the `charset' byte in 60 | * @FT_WinFNT_HeaderRec. Exact mapping tables for the various cpXXXX 61 | * encodings (except for cp1361) can be found at ftp://ftp.unicode.org 62 | * in the MAPPINGS/VENDORS/MICSFT/WINDOWS subdirectory. cp1361 is 63 | * roughly a superset of MAPPINGS/OBSOLETE/EASTASIA/KSC/JOHAB.TXT. 64 | * 65 | * @values: 66 | * FT_WinFNT_ID_DEFAULT :: 67 | * This is used for font enumeration and font creation as a 68 | * `don't care' value. Valid font files don't contain this value. 69 | * When querying for information about the character set of the font 70 | * that is currently selected into a specified device context, this 71 | * return value (of the related Windows API) simply denotes failure. 72 | * 73 | * FT_WinFNT_ID_SYMBOL :: 74 | * There is no known mapping table available. 75 | * 76 | * FT_WinFNT_ID_MAC :: 77 | * Mac Roman encoding. 78 | * 79 | * FT_WinFNT_ID_OEM :: 80 | * From Michael Pöttgen <michael@poettgen.de>: 81 | * 82 | * The `Windows Font Mapping' article says that FT_WinFNT_ID_OEM 83 | * is used for the charset of vector fonts, like `modern.fon', 84 | * `roman.fon', and `script.fon' on Windows. 85 | * 86 | * The `CreateFont' documentation says: The FT_WinFNT_ID_OEM value 87 | * specifies a character set that is operating-system dependent. 88 | * 89 | * The `IFIMETRICS' documentation from the `Windows Driver 90 | * Development Kit' says: This font supports an OEM-specific 91 | * character set. The OEM character set is system dependent. 92 | * 93 | * In general OEM, as opposed to ANSI (i.e., cp1252), denotes the 94 | * second default codepage that most international versions of 95 | * Windows have. It is one of the OEM codepages from 96 | * 97 | * http://www.microsoft.com/globaldev/reference/cphome.mspx, 98 | * 99 | * and is used for the `DOS boxes', to support legacy applications. 100 | * A German Windows version for example usually uses ANSI codepage 101 | * 1252 and OEM codepage 850. 102 | * 103 | * FT_WinFNT_ID_CP874 :: 104 | * A superset of Thai TIS 620 and ISO 8859-11. 105 | * 106 | * FT_WinFNT_ID_CP932 :: 107 | * A superset of Japanese Shift-JIS (with minor deviations). 108 | * 109 | * FT_WinFNT_ID_CP936 :: 110 | * A superset of simplified Chinese GB 2312-1980 (with different 111 | * ordering and minor deviations). 112 | * 113 | * FT_WinFNT_ID_CP949 :: 114 | * A superset of Korean Hangul KS~C 5601-1987 (with different 115 | * ordering and minor deviations). 116 | * 117 | * FT_WinFNT_ID_CP950 :: 118 | * A superset of traditional Chinese Big~5 ETen (with different 119 | * ordering and minor deviations). 120 | * 121 | * FT_WinFNT_ID_CP1250 :: 122 | * A superset of East European ISO 8859-2 (with slightly different 123 | * ordering). 124 | * 125 | * FT_WinFNT_ID_CP1251 :: 126 | * A superset of Russian ISO 8859-5 (with different ordering). 127 | * 128 | * FT_WinFNT_ID_CP1252 :: 129 | * ANSI encoding. A superset of ISO 8859-1. 130 | * 131 | * FT_WinFNT_ID_CP1253 :: 132 | * A superset of Greek ISO 8859-7 (with minor modifications). 133 | * 134 | * FT_WinFNT_ID_CP1254 :: 135 | * A superset of Turkish ISO 8859-9. 136 | * 137 | * FT_WinFNT_ID_CP1255 :: 138 | * A superset of Hebrew ISO 8859-8 (with some modifications). 139 | * 140 | * FT_WinFNT_ID_CP1256 :: 141 | * A superset of Arabic ISO 8859-6 (with different ordering). 142 | * 143 | * FT_WinFNT_ID_CP1257 :: 144 | * A superset of Baltic ISO 8859-13 (with some deviations). 145 | * 146 | * FT_WinFNT_ID_CP1258 :: 147 | * For Vietnamese. This encoding doesn't cover all necessary 148 | * characters. 149 | * 150 | * FT_WinFNT_ID_CP1361 :: 151 | * Korean (Johab). 152 | */ 153 | 154 | #define FT_WinFNT_ID_CP1252 0 155 | #define FT_WinFNT_ID_DEFAULT 1 156 | #define FT_WinFNT_ID_SYMBOL 2 157 | #define FT_WinFNT_ID_MAC 77 158 | #define FT_WinFNT_ID_CP932 128 159 | #define FT_WinFNT_ID_CP949 129 160 | #define FT_WinFNT_ID_CP1361 130 161 | #define FT_WinFNT_ID_CP936 134 162 | #define FT_WinFNT_ID_CP950 136 163 | #define FT_WinFNT_ID_CP1253 161 164 | #define FT_WinFNT_ID_CP1254 162 165 | #define FT_WinFNT_ID_CP1258 163 166 | #define FT_WinFNT_ID_CP1255 177 167 | #define FT_WinFNT_ID_CP1256 178 168 | #define FT_WinFNT_ID_CP1257 186 169 | #define FT_WinFNT_ID_CP1251 204 170 | #define FT_WinFNT_ID_CP874 222 171 | #define FT_WinFNT_ID_CP1250 238 172 | #define FT_WinFNT_ID_OEM 255 173 | 174 | 175 | /*************************************************************************/ 176 | /* */ 177 | /* <Struct> */ 178 | /* FT_WinFNT_HeaderRec */ 179 | /* */ 180 | /* <Description> */ 181 | /* Windows FNT Header info. */ 182 | /* */ 183 | typedef struct FT_WinFNT_HeaderRec_ 184 | { 185 | FT_UShort version; 186 | FT_ULong file_size; 187 | FT_Byte copyright[60]; 188 | FT_UShort file_type; 189 | FT_UShort nominal_point_size; 190 | FT_UShort vertical_resolution; 191 | FT_UShort horizontal_resolution; 192 | FT_UShort ascent; 193 | FT_UShort internal_leading; 194 | FT_UShort external_leading; 195 | FT_Byte italic; 196 | FT_Byte underline; 197 | FT_Byte strike_out; 198 | FT_UShort weight; 199 | FT_Byte charset; 200 | FT_UShort pixel_width; 201 | FT_UShort pixel_height; 202 | FT_Byte pitch_and_family; 203 | FT_UShort avg_width; 204 | FT_UShort max_width; 205 | FT_Byte first_char; 206 | FT_Byte last_char; 207 | FT_Byte default_char; 208 | FT_Byte break_char; 209 | FT_UShort bytes_per_row; 210 | FT_ULong device_offset; 211 | FT_ULong face_name_offset; 212 | FT_ULong bits_pointer; 213 | FT_ULong bits_offset; 214 | FT_Byte reserved; 215 | FT_ULong flags; 216 | FT_UShort A_space; 217 | FT_UShort B_space; 218 | FT_UShort C_space; 219 | FT_UShort color_table_offset; 220 | FT_ULong reserved1[4]; 221 | 222 | } FT_WinFNT_HeaderRec; 223 | 224 | 225 | /*************************************************************************/ 226 | /* */ 227 | /* <Struct> */ 228 | /* FT_WinFNT_Header */ 229 | /* */ 230 | /* <Description> */ 231 | /* A handle to an @FT_WinFNT_HeaderRec structure. */ 232 | /* */ 233 | typedef struct FT_WinFNT_HeaderRec_* FT_WinFNT_Header; 234 | 235 | 236 | /********************************************************************** 237 | * 238 | * @function: 239 | * FT_Get_WinFNT_Header 240 | * 241 | * @description: 242 | * Retrieve a Windows FNT font info header. 243 | * 244 | * @input: 245 | * face :: A handle to the input face. 246 | * 247 | * @output: 248 | * aheader :: The WinFNT header. 249 | * 250 | * @return: 251 | * FreeType error code. 0~means success. 252 | * 253 | * @note: 254 | * This function only works with Windows FNT faces, returning an error 255 | * otherwise. 256 | */ 257 | FT_EXPORT( FT_Error ) 258 | FT_Get_WinFNT_Header( FT_Face face, 259 | FT_WinFNT_HeaderRec *aheader ); 260 | 261 | 262 | /* */ 263 | 264 | FT_END_HEADER 265 | 266 | #endif /* __FTWINFNT_H__ */ 267 | 268 | 269 | /* END */ 270 | 271 | 272 | /* Local Variables: */ 273 | /* coding: utf-8 */ 274 | /* End: */ 275 | -------------------------------------------------------------------------------- /include/freetype2/freetype/ftsystem.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftsystem.h */ 4 | /* */ 5 | /* FreeType low-level system interface definition (specification). */ 6 | /* */ 7 | /* Copyright 1996-2001, 2002, 2005, 2010 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 __FTSYSTEM_H__ 20 | #define __FTSYSTEM_H__ 21 | 22 | 23 | #include <ft2build.h> 24 | 25 | 26 | FT_BEGIN_HEADER 27 | 28 | 29 | /*************************************************************************/ 30 | /* */ 31 | /* <Section> */ 32 | /* system_interface */ 33 | /* */ 34 | /* <Title> */ 35 | /* System Interface */ 36 | /* */ 37 | /* <Abstract> */ 38 | /* How FreeType manages memory and i/o. */ 39 | /* */ 40 | /* <Description> */ 41 | /* This section contains various definitions related to memory */ 42 | /* management and i/o access. You need to understand this */ 43 | /* information if you want to use a custom memory manager or you own */ 44 | /* i/o streams. */ 45 | /* */ 46 | /*************************************************************************/ 47 | 48 | 49 | /*************************************************************************/ 50 | /* */ 51 | /* M E M O R Y M A N A G E M E N T */ 52 | /* */ 53 | /*************************************************************************/ 54 | 55 | 56 | /************************************************************************* 57 | * 58 | * @type: 59 | * FT_Memory 60 | * 61 | * @description: 62 | * A handle to a given memory manager object, defined with an 63 | * @FT_MemoryRec structure. 64 | * 65 | */ 66 | typedef struct FT_MemoryRec_* FT_Memory; 67 | 68 | 69 | /************************************************************************* 70 | * 71 | * @functype: 72 | * FT_Alloc_Func 73 | * 74 | * @description: 75 | * A function used to allocate `size' bytes from `memory'. 76 | * 77 | * @input: 78 | * memory :: 79 | * A handle to the source memory manager. 80 | * 81 | * size :: 82 | * The size in bytes to allocate. 83 | * 84 | * @return: 85 | * Address of new memory block. 0~in case of failure. 86 | * 87 | */ 88 | typedef void* 89 | (*FT_Alloc_Func)( FT_Memory memory, 90 | long size ); 91 | 92 | 93 | /************************************************************************* 94 | * 95 | * @functype: 96 | * FT_Free_Func 97 | * 98 | * @description: 99 | * A function used to release a given block of memory. 100 | * 101 | * @input: 102 | * memory :: 103 | * A handle to the source memory manager. 104 | * 105 | * block :: 106 | * The address of the target memory block. 107 | * 108 | */ 109 | typedef void 110 | (*FT_Free_Func)( FT_Memory memory, 111 | void* block ); 112 | 113 | 114 | /************************************************************************* 115 | * 116 | * @functype: 117 | * FT_Realloc_Func 118 | * 119 | * @description: 120 | * A function used to re-allocate a given block of memory. 121 | * 122 | * @input: 123 | * memory :: 124 | * A handle to the source memory manager. 125 | * 126 | * cur_size :: 127 | * The block's current size in bytes. 128 | * 129 | * new_size :: 130 | * The block's requested new size. 131 | * 132 | * block :: 133 | * The block's current address. 134 | * 135 | * @return: 136 | * New block address. 0~in case of memory shortage. 137 | * 138 | * @note: 139 | * In case of error, the old block must still be available. 140 | * 141 | */ 142 | typedef void* 143 | (*FT_Realloc_Func)( FT_Memory memory, 144 | long cur_size, 145 | long new_size, 146 | void* block ); 147 | 148 | 149 | /************************************************************************* 150 | * 151 | * @struct: 152 | * FT_MemoryRec 153 | * 154 | * @description: 155 | * A structure used to describe a given memory manager to FreeType~2. 156 | * 157 | * @fields: 158 | * user :: 159 | * A generic typeless pointer for user data. 160 | * 161 | * alloc :: 162 | * A pointer type to an allocation function. 163 | * 164 | * free :: 165 | * A pointer type to an memory freeing function. 166 | * 167 | * realloc :: 168 | * A pointer type to a reallocation function. 169 | * 170 | */ 171 | struct FT_MemoryRec_ 172 | { 173 | void* user; 174 | FT_Alloc_Func alloc; 175 | FT_Free_Func free; 176 | FT_Realloc_Func realloc; 177 | }; 178 | 179 | 180 | /*************************************************************************/ 181 | /* */ 182 | /* I / O M A N A G E M E N T */ 183 | /* */ 184 | /*************************************************************************/ 185 | 186 | 187 | /************************************************************************* 188 | * 189 | * @type: 190 | * FT_Stream 191 | * 192 | * @description: 193 | * A handle to an input stream. 194 | * 195 | */ 196 | typedef struct FT_StreamRec_* FT_Stream; 197 | 198 | 199 | /************************************************************************* 200 | * 201 | * @struct: 202 | * FT_StreamDesc 203 | * 204 | * @description: 205 | * A union type used to store either a long or a pointer. This is used 206 | * to store a file descriptor or a `FILE*' in an input stream. 207 | * 208 | */ 209 | typedef union FT_StreamDesc_ 210 | { 211 | long value; 212 | void* pointer; 213 | 214 | } FT_StreamDesc; 215 | 216 | 217 | /************************************************************************* 218 | * 219 | * @functype: 220 | * FT_Stream_IoFunc 221 | * 222 | * @description: 223 | * A function used to seek and read data from a given input stream. 224 | * 225 | * @input: 226 | * stream :: 227 | * A handle to the source stream. 228 | * 229 | * offset :: 230 | * The offset of read in stream (always from start). 231 | * 232 | * buffer :: 233 | * The address of the read buffer. 234 | * 235 | * count :: 236 | * The number of bytes to read from the stream. 237 | * 238 | * @return: 239 | * The number of bytes effectively read by the stream. 240 | * 241 | * @note: 242 | * This function might be called to perform a seek or skip operation 243 | * with a `count' of~0. A non-zero return value then indicates an 244 | * error. 245 | * 246 | */ 247 | typedef unsigned long 248 | (*FT_Stream_IoFunc)( FT_Stream stream, 249 | unsigned long offset, 250 | unsigned char* buffer, 251 | unsigned long count ); 252 | 253 | 254 | /************************************************************************* 255 | * 256 | * @functype: 257 | * FT_Stream_CloseFunc 258 | * 259 | * @description: 260 | * A function used to close a given input stream. 261 | * 262 | * @input: 263 | * stream :: 264 | * A handle to the target stream. 265 | * 266 | */ 267 | typedef void 268 | (*FT_Stream_CloseFunc)( FT_Stream stream ); 269 | 270 | 271 | /************************************************************************* 272 | * 273 | * @struct: 274 | * FT_StreamRec 275 | * 276 | * @description: 277 | * A structure used to describe an input stream. 278 | * 279 | * @input: 280 | * base :: 281 | * For memory-based streams, this is the address of the first stream 282 | * byte in memory. This field should always be set to NULL for 283 | * disk-based streams. 284 | * 285 | * size :: 286 | * The stream size in bytes. 287 | * 288 | * pos :: 289 | * The current position within the stream. 290 | * 291 | * descriptor :: 292 | * This field is a union that can hold an integer or a pointer. It is 293 | * used by stream implementations to store file descriptors or `FILE*' 294 | * pointers. 295 | * 296 | * pathname :: 297 | * This field is completely ignored by FreeType. However, it is often 298 | * useful during debugging to use it to store the stream's filename 299 | * (where available). 300 | * 301 | * read :: 302 | * The stream's input function. 303 | * 304 | * close :: 305 | * The stream's close function. 306 | * 307 | * memory :: 308 | * The memory manager to use to preload frames. This is set 309 | * internally by FreeType and shouldn't be touched by stream 310 | * implementations. 311 | * 312 | * cursor :: 313 | * This field is set and used internally by FreeType when parsing 314 | * frames. 315 | * 316 | * limit :: 317 | * This field is set and used internally by FreeType when parsing 318 | * frames. 319 | * 320 | */ 321 | typedef struct FT_StreamRec_ 322 | { 323 | unsigned char* base; 324 | unsigned long size; 325 | unsigned long pos; 326 | 327 | FT_StreamDesc descriptor; 328 | FT_StreamDesc pathname; 329 | FT_Stream_IoFunc read; 330 | FT_Stream_CloseFunc close; 331 | 332 | FT_Memory memory; 333 | unsigned char* cursor; 334 | unsigned char* limit; 335 | 336 | } FT_StreamRec; 337 | 338 | 339 | /* */ 340 | 341 | 342 | FT_END_HEADER 343 | 344 | #endif /* __FTSYSTEM_H__ */ 345 | 346 | 347 | /* END */ 348 | -------------------------------------------------------------------------------- /include/freetype2/freetype/ftsnames.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftsnames.h */ 4 | /* */ 5 | /* Simple interface to access SFNT name tables (which are used */ 6 | /* to hold font names, copyright info, notices, etc.) (specification). */ 7 | /* */ 8 | /* This is _not_ used to retrieve glyph names! */ 9 | /* */ 10 | /* Copyright 1996-2001, 2002, 2003, 2006, 2009, 2010 by */ 11 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 12 | /* */ 13 | /* This file is part of the FreeType project, and may only be used, */ 14 | /* modified, and distributed under the terms of the FreeType project */ 15 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 16 | /* this file you indicate that you have read the license and */ 17 | /* understand and accept it fully. */ 18 | /* */ 19 | /***************************************************************************/ 20 | 21 | 22 | #ifndef __FT_SFNT_NAMES_H__ 23 | #define __FT_SFNT_NAMES_H__ 24 | 25 | 26 | #include <ft2build.h> 27 | #include FT_FREETYPE_H 28 | 29 | #ifdef FREETYPE_H 30 | #error "freetype.h of FreeType 1 has been loaded!" 31 | #error "Please fix the directory search order for header files" 32 | #error "so that freetype.h of FreeType 2 is found first." 33 | #endif 34 | 35 | 36 | FT_BEGIN_HEADER 37 | 38 | 39 | /*************************************************************************/ 40 | /* */ 41 | /* <Section> */ 42 | /* sfnt_names */ 43 | /* */ 44 | /* <Title> */ 45 | /* SFNT Names */ 46 | /* */ 47 | /* <Abstract> */ 48 | /* Access the names embedded in TrueType and OpenType files. */ 49 | /* */ 50 | /* <Description> */ 51 | /* The TrueType and OpenType specifications allow the inclusion of */ 52 | /* a special `names table' in font files. This table contains */ 53 | /* textual (and internationalized) information regarding the font, */ 54 | /* like family name, copyright, version, etc. */ 55 | /* */ 56 | /* The definitions below are used to access them if available. */ 57 | /* */ 58 | /* Note that this has nothing to do with glyph names! */ 59 | /* */ 60 | /*************************************************************************/ 61 | 62 | 63 | /*************************************************************************/ 64 | /* */ 65 | /* <Struct> */ 66 | /* FT_SfntName */ 67 | /* */ 68 | /* <Description> */ 69 | /* A structure used to model an SFNT `name' table entry. */ 70 | /* */ 71 | /* <Fields> */ 72 | /* platform_id :: The platform ID for `string'. */ 73 | /* */ 74 | /* encoding_id :: The encoding ID for `string'. */ 75 | /* */ 76 | /* language_id :: The language ID for `string'. */ 77 | /* */ 78 | /* name_id :: An identifier for `string'. */ 79 | /* */ 80 | /* string :: The `name' string. Note that its format differs */ 81 | /* depending on the (platform,encoding) pair. It can */ 82 | /* be a Pascal String, a UTF-16 one, etc. */ 83 | /* */ 84 | /* Generally speaking, the string is not */ 85 | /* zero-terminated. Please refer to the TrueType */ 86 | /* specification for details. */ 87 | /* */ 88 | /* string_len :: The length of `string' in bytes. */ 89 | /* */ 90 | /* <Note> */ 91 | /* Possible values for `platform_id', `encoding_id', `language_id', */ 92 | /* and `name_id' are given in the file `ttnameid.h'. For details */ 93 | /* please refer to the TrueType or OpenType specification. */ 94 | /* */ 95 | /* See also @TT_PLATFORM_XXX, @TT_APPLE_ID_XXX, @TT_MAC_ID_XXX, */ 96 | /* @TT_ISO_ID_XXX, and @TT_MS_ID_XXX. */ 97 | /* */ 98 | typedef struct FT_SfntName_ 99 | { 100 | FT_UShort platform_id; 101 | FT_UShort encoding_id; 102 | FT_UShort language_id; 103 | FT_UShort name_id; 104 | 105 | FT_Byte* string; /* this string is *not* null-terminated! */ 106 | FT_UInt string_len; /* in bytes */ 107 | 108 | } FT_SfntName; 109 | 110 | 111 | /*************************************************************************/ 112 | /* */ 113 | /* <Function> */ 114 | /* FT_Get_Sfnt_Name_Count */ 115 | /* */ 116 | /* <Description> */ 117 | /* Retrieve the number of name strings in the SFNT `name' table. */ 118 | /* */ 119 | /* <Input> */ 120 | /* face :: A handle to the source face. */ 121 | /* */ 122 | /* <Return> */ 123 | /* The number of strings in the `name' table. */ 124 | /* */ 125 | FT_EXPORT( FT_UInt ) 126 | FT_Get_Sfnt_Name_Count( FT_Face face ); 127 | 128 | 129 | /*************************************************************************/ 130 | /* */ 131 | /* <Function> */ 132 | /* FT_Get_Sfnt_Name */ 133 | /* */ 134 | /* <Description> */ 135 | /* Retrieve a string of the SFNT `name' table for a given index. */ 136 | /* */ 137 | /* <Input> */ 138 | /* face :: A handle to the source face. */ 139 | /* */ 140 | /* idx :: The index of the `name' string. */ 141 | /* */ 142 | /* <Output> */ 143 | /* aname :: The indexed @FT_SfntName structure. */ 144 | /* */ 145 | /* <Return> */ 146 | /* FreeType error code. 0~means success. */ 147 | /* */ 148 | /* <Note> */ 149 | /* The `string' array returned in the `aname' structure is not */ 150 | /* null-terminated. The application should deallocate it if it is no */ 151 | /* longer in use. */ 152 | /* */ 153 | /* Use @FT_Get_Sfnt_Name_Count to get the total number of available */ 154 | /* `name' table entries, then do a loop until you get the right */ 155 | /* platform, encoding, and name ID. */ 156 | /* */ 157 | FT_EXPORT( FT_Error ) 158 | FT_Get_Sfnt_Name( FT_Face face, 159 | FT_UInt idx, 160 | FT_SfntName *aname ); 161 | 162 | 163 | /*************************************************************************** 164 | * 165 | * @constant: 166 | * FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY 167 | * 168 | * @description: 169 | * A constant used as the tag of @FT_Parameter structures to make 170 | * FT_Open_Face() ignore preferred family subfamily names in `name' 171 | * table since OpenType version 1.4. For backwards compatibility with 172 | * legacy systems which has 4-face-per-family restriction. 173 | * 174 | */ 175 | #define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY FT_MAKE_TAG( 'i', 'g', 'p', 'f' ) 176 | 177 | 178 | /*************************************************************************** 179 | * 180 | * @constant: 181 | * FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY 182 | * 183 | * @description: 184 | * A constant used as the tag of @FT_Parameter structures to make 185 | * FT_Open_Face() ignore preferred subfamily names in `name' table since 186 | * OpenType version 1.4. For backwards compatibility with legacy 187 | * systems which has 4-face-per-family restriction. 188 | * 189 | */ 190 | #define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY FT_MAKE_TAG( 'i', 'g', 'p', 's' ) 191 | 192 | /* */ 193 | 194 | 195 | FT_END_HEADER 196 | 197 | #endif /* __FT_SFNT_NAMES_H__ */ 198 | 199 | 200 | /* END */ 201 | --------------------------------------------------------------------------------