Permalink
Browse files

Add OS/2 table support.

  • Loading branch information...
1 parent 351d5a3 commit 29e5fa637965d7ce2c1b9b1347d8fe6054a71243 @jdm jdm committed Dec 26, 2012
Showing with 56 additions and 0 deletions.
  1. +1 −0 freetype.rc
  2. +15 −0 freetype.rs
  3. +40 −0 tt_os2.rs
View
@@ -5,3 +5,4 @@
extern mod std;
pub mod freetype;
+pub mod tt_os2;
View
@@ -60,6 +60,17 @@ type struct_FT_BBox_ = {
type FT_BBox = struct_FT_BBox_;
+type enum_FT_Sfnt_Tag_ = c_uint;
+const ft_sfnt_head: u32 = 0_u32;
+const ft_sfnt_maxp: u32 = 1_u32;
+const ft_sfnt_os2: u32 = 2_u32;
+const ft_sfnt_hhea: u32 = 3_u32;
+const ft_sfnt_vhea: u32 = 4_u32;
+const ft_sfnt_post: u32 = 5_u32;
+const ft_sfnt_pclt: u32 = 6_u32;
+const ft_sfnt_max: u32 = 7_u32;
+type FT_Sfnt_Tag = enum_FT_Sfnt_Tag_;
+
type enum_FT_Pixel_Mode_ = c_uint;
const FT_PIXEL_MODE_NONE: u32 = 0_u32;
const FT_PIXEL_MODE_MONO: u32 = 1_u32;
@@ -332,6 +343,9 @@ type FT_CharMapRec = struct_FT_CharMapRec_;
type struct_FT_Face_InternalRec_ = c_void;
type FT_Face_Internal = *struct_FT_Face_InternalRec_;
+const FT_STYLE_FLAG_ITALIC: FT_Long = (1 << 0);
+const FT_STYLE_FLAG_BOLD: FT_Long = (1 << 1);
+
type struct_FT_FaceRec_ = {
num_faces: FT_Long,
face_index: FT_Long,
@@ -692,4 +706,5 @@ fn FT_Face_CheckTrueTypePatents(++face: FT_Face) -> FT_Bool;
fn FT_Face_SetUnpatentedHinting(++face: FT_Face, ++value: FT_Bool) -> FT_Bool;
+fn FT_Get_Sfnt_Table(face: FT_Face, tag: FT_Sfnt_Tag) -> *c_void;
}
View
@@ -0,0 +1,40 @@
+use freetype::{FT_UShort, FT_Short, FT_ULong, FT_Byte};
+
+struct TT_OS2 {
+ version: FT_UShort,
+ xAvgCharWidth: FT_Short,
+ usWeightClass: FT_UShort,
+ usWidthClass: FT_UShort,
+ fsType: FT_Short,
+ ySubscriptXSize: FT_Short,
+ ySubscriptYSize: FT_Short,
+ ySubscriptXOffset: FT_Short,
+ ySubscriptYOffset: FT_Short,
+ ySuperscriptXSize: FT_Short,
+ ySuperscriptYSize: FT_Short,
+ ySuperscriptXOffset: FT_Short,
+ ySuperscriptYOffset: FT_Short,
+ yStrikeoutSize: FT_Short,
+ yStrikeoutPosition: FT_Short,
+ sFamilyClass: FT_Short,
+
+ panose: [FT_Byte * 10],
+
+ ulUnicodeRange1: FT_ULong, /* Bits 0-31 */
+ ulUnicodeRange2: FT_ULong, /* Bits 32-63 */
+ ulUnicodeRange3: FT_ULong, /* Bits 64-95 */
+ ulUnicodeRange4: FT_ULong, /* Bits 96-127 */
+
+ /* only version 1 tables */
+
+ ulCodePageRange1: FT_ULong, /* Bits 0-31 */
+ ulCodePageRange2: FT_ULong, /* Bits 32-63 */
+
+ /* only version 2 tables */
+
+ sxHeight: FT_Short,
+ sCapHeight: FT_Short,
+ usDefaultChar: FT_UShort,
+ usBreakChar: FT_UShort,
+ usMaxContext: FT_UShort,
+}

0 comments on commit 29e5fa6

Please sign in to comment.