ft2-ruby 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/CHANGELOG.md ADDED
@@ -0,0 +1,60 @@
1
+ # ft2-ruby changelog #
2
+
3
+ ## 0.1.4 ##
4
+ ### Fri Apr 27 11:39:28 2012 by [sethvargo](http://www.github.com/sethvargo) ###
5
+ - Added MIT license
6
+
7
+ ### Fri Apr 27 11:39:28 2012 by [wingrunr21](http://www.github.com/wingrunr21) ###
8
+ - Restructured gem to match modern standards
9
+ - Changed instances of RSTRING(foo)->ptr to RSTRING_PTR(foo)
10
+ - Gem is now managed with Bundler.
11
+ - Removed unnecessary files (MANIFEST, VERSION)
12
+ - Converted information files to Markdown
13
+
14
+ ## 0.1.3 ##
15
+ ### Tue Oct 19 14:07:07 2010 by [dvanderson](http://www.github.com/dvanderson) ###
16
+ - fix a cast that was breaking compilation on OS X
17
+
18
+ ## 0.1.2 ##
19
+ ### Wed Oct 19 15:23:38 2010 by [dvanderson](http://www.github.com/dvanderson) ###
20
+ - fix to get cbox for glyphs
21
+
22
+ ### Wed Feb 10 19:45:20 2010 by [andrewwillis](http://www.github.com/andrewwillis) ###
23
+ - move gem to jeweler
24
+ - Update native extension to work correctly with ft2
25
+ - fix compiler errors
26
+
27
+ ## 0.1.1 and before ##
28
+ ### Thu Nov 21 15:18:26 2002 by [pabs](pabs@pablotron.org) and [andrewwillis](http://www.github.com/andrewwillis) ###
29
+ - ft2.c: finished documenting and implementing FT2::Glyph,
30
+ FT2::BitmapGlyph, and FT2::OutlineGlyph.
31
+ - ft2.c: compiles clean with -W -Wall -pedantic again
32
+ - TODO: updated
33
+
34
+ ### Wed Nov 20 16:11:10 2002 by [pabs](pabs@pablotron.org) ###
35
+ - ft2.c: finished documenting the FT2::SizeMetrics methods (had to
36
+ pull the documentation for them out of the second part of the
37
+ FreeType2 tutorial, since they're not available in the API
38
+ reference).
39
+
40
+ ### Sat Nov 16 01:45:42 2002 by [pabs](pabs@pablotron.org) ###
41
+ - ft2.c: finished documentation for FT2::GlyphSlot methods.
42
+
43
+ ### Fri Nov 15 15:15:37 2002 by [pabs](pabs@pablotron.org) ###
44
+ - ft2.c: finished documentation for FT2::GlyphMetrics methods.
45
+
46
+ ### Fri Nov 15 03:52:46 2002 by [pabs](pabs@pablotron.org) ###
47
+ - ft2.c: added FT2::Face#current_charmap
48
+
49
+ ### Fri Nov 15 03:27:50 2002 by [pabs](pabs@pablotron.org) ###
50
+ - ft2.c: finished documentation for FT2::Face methods.
51
+
52
+ ### Tue Nov 12 17:20:23 2002 by [pabs](pabs@pablotron.org) ###
53
+ - made some changes according to the notes in the freetype2 headers:
54
+ - ft2.c: removed FT2::PixelMode::RGB and FT2::PixelMode::RGBA constants
55
+ - ft2.c: removed Ft2::PaletteMode
56
+ - compiles clean with -W -Wall -pedantic again
57
+
58
+ ### Thu Aug 15 09:39:24 2002 by [pabs](pabs@pablotron.org) ###
59
+ - created changelog.
60
+
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Paul Duncan
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # FT2-Ruby #
2
+
3
+ This gem provides [FreeType2](http://www.freetype.org/) bindings for Ruby.
4
+
5
+ ## Installation ##
6
+
7
+ gem install ft2-ruby
8
+
9
+ ## About the Author ##
10
+ Paul Duncan <pabs@pablotron.org>
11
+ http://www.pablotron.org/
12
+
13
+ Maintained by [CustomInk](http://technology.customink.com/)
14
+
15
+
data/{TODO → TODO.md} RENAMED
@@ -1,3 +1,6 @@
1
+ TODO
2
+ ====
3
+
1
4
  * fixed point data conversions
2
5
  * face subglyph handling
3
6
  * test test test test!
@@ -7,4 +7,3 @@ $LDFLAGS << ' ' << `#{ft2_config} --libs`.chomp
7
7
 
8
8
  have_library("freetype", "FT_Init_FreeType") and
9
9
  create_makefile("ft2")
10
-
@@ -29,7 +29,6 @@
29
29
  #include FT_FREETYPE_H
30
30
  #include FT_GLYPH_H
31
31
 
32
- #define VERSION "0.1.0"
33
32
  #define UNUSED(a) ((void) (a))
34
33
  #define ABS(a) (((a) < 0) ? -(a) : (a))
35
34
 
@@ -153,7 +152,7 @@ static VALUE ft_bitmap_width(VALUE self) {
153
152
  *
154
153
  * Return the pitch (bytes per row, including alignment padding) of an
155
154
  * FT2::Bitmap object.
156
- *
155
+ *
157
156
  * Examples:
158
157
  * width = bitmap.width
159
158
  *
@@ -348,7 +347,7 @@ VALUE ft_face_new(int argc, VALUE *argv, VALUE klass) {
348
347
  }
349
348
 
350
349
  face = malloc(sizeof(FT_Face));
351
- err = FT_New_Face(*lib, RSTRING(path)->ptr, face_index, face);
350
+ err = FT_New_Face(*lib, RSTRING_PTR(path), face_index, face);
352
351
  if (err != FT_Err_Ok)
353
352
  handle_error(err);
354
353
 
@@ -391,18 +390,18 @@ VALUE ft_face_new_from_memory(int argc, VALUE *argv, VALUE klass) {
391
390
  lib = &library;
392
391
  switch (argc) {
393
392
  case 2:
394
- mem = RSTRING(argv[0])->ptr;
393
+ mem = RSTRING_PTR(argv[0]);
395
394
  len = NUM2INT(argv[1]);
396
395
  face_index = 0;
397
396
  break;
398
397
  case 3:
399
398
  if (rb_obj_is_kind_of(argv[0], rb_cString)) {
400
- mem = RSTRING(argv[0])->ptr;
399
+ mem = RSTRING_PTR(argv[0]);
401
400
  len = NUM2INT(argv[1]);
402
401
  face_index = NUM2INT(argv[2]);
403
402
  } else if (rb_obj_is_kind_of(argv[0], cLibrary)) {
404
403
  Data_Get_Struct(argv[0], FT_Library, lib);
405
- mem = RSTRING(argv[1])->ptr;
404
+ mem = RSTRING_PTR(argv[1]);
406
405
  len = NUM2INT(argv[2]);
407
406
  face_index = 0;
408
407
  } else {
@@ -411,7 +410,7 @@ VALUE ft_face_new_from_memory(int argc, VALUE *argv, VALUE klass) {
411
410
  break;
412
411
  case 4:
413
412
  Data_Get_Struct(argv[0], FT_Library, lib);
414
- mem = RSTRING(argv[1])->ptr;
413
+ mem = RSTRING_PTR(argv[1]);
415
414
  len = NUM2INT(argv[2]);
416
415
  face_index = NUM2INT(argv[3]);
417
416
  break;
@@ -511,7 +510,7 @@ static VALUE ft_face_index(VALUE self) {
511
510
  * FT2::Face#kerning?
512
511
  * FT2::Face#external_stream?
513
512
  * FT2::Face#fast_glyphs?
514
- *
513
+ *
515
514
  * Aliases:
516
515
  * FT2::Face#face_flags
517
516
  *
@@ -540,7 +539,7 @@ static VALUE ft_face_flag_scalable(VALUE self) {
540
539
  return ((*face)->face_flags & FT_FACE_FLAG_SCALABLE) ? Qtrue : Qfalse;
541
540
  }
542
541
 
543
- /*
542
+ /*
544
543
  * Does this FT2::Face contain bitmap strikes for some pixel sizes?
545
544
  *
546
545
  * Examples:
@@ -567,7 +566,7 @@ static VALUE ft_face_flag_fixed_width(VALUE self) {
567
566
  }
568
567
 
569
568
  /*
570
- * Does this FT2::Face contain horizontal glyph metrics?
569
+ * Does this FT2::Face contain horizontal glyph metrics?
571
570
  *
572
571
  * Note:
573
572
  * This flag is true for virtually all fonts.
@@ -583,7 +582,7 @@ static VALUE ft_face_flag_horizontal(VALUE self) {
583
582
  }
584
583
 
585
584
  /*
586
- * Does this FT2::Face contain vertical glyph metrics?
585
+ * Does this FT2::Face contain vertical glyph metrics?
587
586
  *
588
587
  * Note:
589
588
  * If this flag is not set, the glyph loader will synthesize vertical
@@ -600,7 +599,7 @@ static VALUE ft_face_flag_vertical(VALUE self) {
600
599
  }
601
600
 
602
601
  /*
603
- * Is this FT2::Face stored in the 'sfnt' storage format?
602
+ * Is this FT2::Face stored in the 'sfnt' storage format?
604
603
  *
605
604
  * Note:
606
605
  * This currently means the file was either TrueType or OpenType.
@@ -616,7 +615,7 @@ static VALUE ft_face_flag_sfnt(VALUE self) {
616
615
  }
617
616
 
618
617
  /*
619
- * Does this FT2::Face contain kerning information?
618
+ * Does this FT2::Face contain kerning information?
620
619
  *
621
620
  * Examples:
622
621
  * puts "face contains kerning information" if face.kerning?
@@ -642,11 +641,11 @@ static VALUE ft_face_flag_external_stream(VALUE self) {
642
641
  }
643
642
 
644
643
  /*
645
- * Does this FT2::Face contain fast glyphs?
644
+ * Does this FT2::Face contain fast glyphs?
646
645
  *
647
646
  * Note:
648
647
  * This flag is usually set for fixed-size formats like FNT.
649
- *
648
+ *
650
649
  * Examples:
651
650
  * puts "face contains fast glyphs" if face.fast_glyphs?
652
651
  *
@@ -687,7 +686,7 @@ static VALUE ft_face_style_flags(VALUE self) {
687
686
  }
688
687
 
689
688
  /*
690
- * Is this a bold FT2::Face?
689
+ * Is this a bold FT2::Face?
691
690
  *
692
691
  * Examples:
693
692
  * puts "bold face" if face.bold?
@@ -700,7 +699,7 @@ static VALUE ft_face_flag_bold(VALUE self) {
700
699
  }
701
700
 
702
701
  /*
703
- * Is this an italic FT2::Face?
702
+ * Is this an italic FT2::Face?
704
703
  *
705
704
  * Examples:
706
705
  * puts "italic face" if face.italic?
@@ -713,7 +712,7 @@ static VALUE ft_face_flag_italic(VALUE self) {
713
712
  }
714
713
 
715
714
  /*
716
- * Return the number of glyphs in an FT2::Face object.
715
+ * Return the number of glyphs in an FT2::Face object.
717
716
  *
718
717
  * Aliases:
719
718
  * FT2::Face#num_glyphs
@@ -730,15 +729,15 @@ static VALUE ft_face_glyphs(VALUE self) {
730
729
  }
731
730
 
732
731
  /*
733
- * Return the family name of an FT2::Face object.
732
+ * Return the family name of an FT2::Face object.
734
733
  *
735
- * Description:
734
+ * Description:
736
735
  * This is an ASCII string, usually in English, which describes the
737
736
  * FT2::Face object's family (eg "Times New Roman" or "Geneva"). Some
738
737
  * formats (eg Truetype and OpenType) provide localized and Unicode
739
738
  * versions of this string, which are accessable via the format specific
740
739
  * interfaces.
741
- *
740
+ *
742
741
  * Examples:
743
742
  * puts 'family: ' << face.family
744
743
  *
@@ -750,13 +749,13 @@ static VALUE ft_face_family(VALUE self) {
750
749
  }
751
750
 
752
751
  /*
753
- * Return the style name of an FT2::Face object.
752
+ * Return the style name of an FT2::Face object.
754
753
  *
755
754
  * Description:
756
755
  * This is an ASCII string, usually in English, which describes the
757
756
  * FT2::Face object's style (eg "Bold", "Italic", "Condensed", etc).
758
757
  * This field is optional and may be set to nil.
759
- *
758
+ *
760
759
  * Examples:
761
760
  * puts 'style: ' << face.style if face.style
762
761
  *
@@ -770,12 +769,12 @@ static VALUE ft_face_style(VALUE self) {
770
769
  }
771
770
 
772
771
  /*
773
- * Return the number of fixed sizes in an FT2::Face object.
772
+ * Return the number of fixed sizes in an FT2::Face object.
774
773
  *
775
774
  * Note:
776
775
  * This should be set to 0 for scalable fonts, unless the FT2::Face
777
776
  * object contains a complete set of glyphs for the specified size.
778
- *
777
+ *
779
778
  * Aliases:
780
779
  * FT2::Face#num_fixed_sizes
781
780
  *
@@ -790,11 +789,11 @@ static VALUE ft_face_fixed_sizes(VALUE self) {
790
789
  }
791
790
 
792
791
  /*
793
- * Return an array of sizes in an FT2::Face object.
792
+ * Return an array of sizes in an FT2::Face object.
794
793
  *
795
794
  * Note:
796
795
  * This method does not currently work..
797
- *
796
+ *
798
797
  * Examples:
799
798
  * face.available_sizesdflksjaflksdjf FIXME
800
799
  *
@@ -821,7 +820,7 @@ static VALUE ft_face_num_charmaps(VALUE self) {
821
820
 
822
821
  /*
823
822
  * Return an array of charmaps in an FT2::Face object.
824
- *
823
+ *
825
824
  * Note:
826
825
  * This method may not work correctly at the moment (FIXME).
827
826
  *
@@ -840,13 +839,13 @@ static VALUE ft_face_charmaps(VALUE self) {
840
839
  ary = rb_ary_new();
841
840
  for (i = 0; i < (*face)->num_charmaps; i++)
842
841
  rb_ary_push(ary, INT2FIX(i));
843
-
842
+
844
843
  return ary;
845
844
  }
846
845
 
847
846
  /*
848
847
  * Return the bounding box of an FT2::Face object.
849
- *
848
+ *
850
849
  * Note:
851
850
  * This method is not currently implemented (FIXME).
852
851
  *
@@ -863,7 +862,7 @@ static VALUE ft_face_bbox(VALUE self) {
863
862
 
864
863
  /*
865
864
  * Return the number of font units per EM for this FT2::Face object.
866
- *
865
+ *
867
866
  * Description:
868
867
  * This value is typically 2048 for TrueType fonts, 1000 for Type1
869
868
  * fonts, and should be set to the (unrealistic) value 1 for
@@ -884,7 +883,7 @@ static VALUE ft_face_units_per_em(VALUE self) {
884
883
 
885
884
  /*
886
885
  * Return the ascender for this FT2::Face object.
887
- *
886
+ *
888
887
  * Description:
889
888
  * An FT2::Face object's ascender is the vertical distance, in font
890
889
  * units, from the baseline to the topmost point of any glyph in the
@@ -902,7 +901,7 @@ static VALUE ft_face_ascender(VALUE self) {
902
901
 
903
902
  /*
904
903
  * Return the descender for this FT2::Face object.
905
- *
904
+ *
906
905
  * Description:
907
906
  * An FT2::Face object's descender is the vertical distance, in font
908
907
  * units, from the baseline to the bottommost point of any glyph in
@@ -920,7 +919,7 @@ static VALUE ft_face_descender(VALUE self) {
920
919
 
921
920
  /*
922
921
  * Return the height of this FT2::Face object.
923
- *
922
+ *
924
923
  * Description:
925
924
  * An FT2::Face object's height is the vertical distance, in font
926
925
  * units, from the baseline of one line to the baseline of the next.
@@ -939,7 +938,7 @@ static VALUE ft_face_height(VALUE self) {
939
938
 
940
939
  /*
941
940
  * Return the maximal advance width of this FT2::Face object.
942
- *
941
+ *
943
942
  * Description:
944
943
  * The maximal advance width, in font units, for all glyphs in this
945
944
  * FT2::Face object. This can be used to make word-wrapping
@@ -957,7 +956,7 @@ static VALUE ft_face_max_advance_width(VALUE self) {
957
956
 
958
957
  /*
959
958
  * Return the maximal advance height of this FT2::Face object.
960
- *
959
+ *
961
960
  * Description:
962
961
  * The maximal advance height, in font units, for all glyphs in this
963
962
  * FT2::Face object. This can be used to make word-wrapping
@@ -975,7 +974,7 @@ static VALUE ft_face_max_advance_height(VALUE self) {
975
974
 
976
975
  /*
977
976
  * Return the underline position of this FT2::Face object.
978
- *
977
+ *
979
978
  * Description:
980
979
  * The position, in font units, of the underline line for this face.
981
980
  * It's the center of the underlining stem. Only relevant for scalable
@@ -993,7 +992,7 @@ static VALUE ft_face_underline_position(VALUE self) {
993
992
 
994
993
  /*
995
994
  * Return the underline thickness of this FT2::Face object.
996
- *
995
+ *
997
996
  * Description:
998
997
  * The thickness, in font units, of the underline for this face. Only
999
998
  * relevant for scalable formats.
@@ -1009,7 +1008,7 @@ static VALUE ft_face_underline_thickness(VALUE self) {
1009
1008
  }
1010
1009
  /*
1011
1010
  * Return the glyph slot associated with this FT2::Face object.
1012
- *
1011
+ *
1013
1012
  * Description:
1014
1013
  * The face's associated glyph slot(s) (a FT2::GlyphSlot). This object
1015
1014
  * is created automatically with a new FT2::Face object. However,
@@ -1024,7 +1023,7 @@ static VALUE ft_face_glyph(VALUE self) {
1024
1023
  FT_Face *face;
1025
1024
  Data_Get_Struct(self, FT_Face, face);
1026
1025
 
1027
- if ((*face)->glyph)
1026
+ if ((*face)->glyph)
1028
1027
  return Data_Wrap_Struct(cGlyphSlot, 0, dont_free, &((*face)->glyph));
1029
1028
  else
1030
1029
  return Qnil;
@@ -1032,7 +1031,7 @@ static VALUE ft_face_glyph(VALUE self) {
1032
1031
 
1033
1032
  /*
1034
1033
  * Return the current active size of this FT2::Face object.
1035
- *
1034
+ *
1036
1035
  * Examples:
1037
1036
  * size = face.size
1038
1037
  *
@@ -1041,7 +1040,7 @@ static VALUE ft_face_size(VALUE self) {
1041
1040
  FT_Face *face;
1042
1041
  Data_Get_Struct(self, FT_Face, face);
1043
1042
 
1044
- if ((*face)->size)
1043
+ if ((*face)->size)
1045
1044
  return Data_Wrap_Struct(cSize, 0, dont_free, (*face)->size);
1046
1045
  else
1047
1046
  return Qnil;
@@ -1049,7 +1048,7 @@ static VALUE ft_face_size(VALUE self) {
1049
1048
 
1050
1049
  /*
1051
1050
  * Return the current active FT2::CharMap of this FT2::Face object.
1052
- *
1051
+ *
1053
1052
  * Examples:
1054
1053
  * size = face.size
1055
1054
  *
@@ -1058,13 +1057,13 @@ static VALUE ft_face_charmap(VALUE self) {
1058
1057
  FT_Face *face;
1059
1058
  Data_Get_Struct(self, FT_Face, face);
1060
1059
 
1061
- if ((*face)->charmap)
1060
+ if ((*face)->charmap)
1062
1061
  return Data_Wrap_Struct(cCharMap, 0, dont_free, (*face)->charmap);
1063
1062
  else
1064
1063
  return Qnil;
1065
1064
  }
1066
1065
 
1067
- /*
1066
+ /*
1068
1067
  * Attach a font file to this FT2::Face object.
1069
1068
  *
1070
1069
  * Description:
@@ -1088,12 +1087,12 @@ static VALUE ft_face_attach(VALUE self, VALUE path) {
1088
1087
  FT_Face *face;
1089
1088
  FT_Error err;
1090
1089
  Data_Get_Struct(self, FT_Face, face);
1091
- if ((err = FT_Attach_File(*face, RSTRING(path)->ptr)) != FT_Err_Ok)
1090
+ if ((err = FT_Attach_File(*face, RSTRING_PTR(path))) != FT_Err_Ok)
1092
1091
  handle_error(err);
1093
1092
  return self;
1094
1093
  }
1095
1094
 
1096
- /*
1095
+ /*
1097
1096
  * Set the character dimensions of this FT2::Face object.
1098
1097
  *
1099
1098
  * Description:
@@ -1122,7 +1121,7 @@ static VALUE ft_face_set_char_size(VALUE self, VALUE c_w, VALUE c_h, VALUE h_r,
1122
1121
  return self;
1123
1122
  }
1124
1123
 
1125
- /*
1124
+ /*
1126
1125
  * Set the character dimensions of this FT2::Face object.
1127
1126
  *
1128
1127
  * Description:
@@ -1131,7 +1130,7 @@ static VALUE ft_face_set_char_size(VALUE self, VALUE c_w, VALUE c_h, VALUE h_r,
1131
1130
  *
1132
1131
  * If one of the character dimensions is zero, its value is set equal
1133
1132
  * to the other.
1134
- *
1133
+ *
1135
1134
  * The values of `pixel_width' and `pixel_height' correspond to the
1136
1135
  * pixel values of the typographic character size, which are NOT
1137
1136
  * necessarily the same as the dimensions of the glyph `bitmap cells'.
@@ -1143,7 +1142,7 @@ static VALUE ft_face_set_char_size(VALUE self, VALUE c_w, VALUE c_h, VALUE h_r,
1143
1142
  * This means that setting the pixel size to, say, 8x8 doesn't
1144
1143
  * guarantee in any way that you will get glyph bitmaps that all fit
1145
1144
  * within an 8x8 cell (sometimes even far from it).
1146
- *
1145
+ *
1147
1146
  * Examples:
1148
1147
  * face.set_pixel_sizes pixel_width, pixel_height
1149
1148
  *
@@ -1158,18 +1157,18 @@ static VALUE ft_face_set_pixel_sizes(VALUE self, VALUE pixel_w, VALUE pixel_h) {
1158
1157
  return self;
1159
1158
  }
1160
1159
 
1161
- /*
1160
+ /*
1162
1161
  * Set the pre-render transoformation matrix and vector of a FT2::Face object.
1163
1162
  *
1164
1163
  * Description:
1165
1164
  * Used to set the transformation that is applied to glyph images just
1166
1165
  * before they are converted to bitmaps in a FT2::GlyphSlot when
1167
1166
  * FT2::GlyphSlot#render is called.
1168
- *
1167
+ *
1169
1168
  * matrix: The transformation's 2x2 matrix. Use nil for the identity
1170
1169
  * matrix.
1171
1170
  * delta: The translation vector. Use nil for the null vector.
1172
- *
1171
+ *
1173
1172
  * Note:
1174
1173
  * The transformation is only applied to scalable image formats after
1175
1174
  * the glyph has been loaded. It means that hinting is unaltered by
@@ -1219,7 +1218,7 @@ static VALUE ft_face_set_transform(VALUE self, VALUE matrix, VALUE delta) {
1219
1218
 
1220
1219
  /*
1221
1220
  * Load a glyph at a given size into a glyph slot of a FT2::Face object.
1222
- *
1221
+ *
1223
1222
  * Description:
1224
1223
  * Load a glyph at a given size into a glyph slot of a FT2::Face
1225
1224
  * object.
@@ -1255,7 +1254,7 @@ static VALUE ft_face_set_transform(VALUE self, VALUE matrix, VALUE delta) {
1255
1254
  * FT2::Load::FORCE_AUTOHINT
1256
1255
  * FT2::Load::NO_RECURSE
1257
1256
  * FT2::Load::PEDANTIC
1258
- *
1257
+ *
1259
1258
  * Examples:
1260
1259
  * face.load_glyph 5, FT2::Load::DEFAULT
1261
1260
  *
@@ -1267,7 +1266,7 @@ static VALUE ft_face_load_glyph(VALUE self, VALUE glyph_index, VALUE flags) {
1267
1266
  Data_Get_Struct(self, FT_Face, face);
1268
1267
  if (flags == Qnil)
1269
1268
  flags = INT2FIX(FT_LOAD_DEFAULT);
1270
-
1269
+
1271
1270
  err = FT_Load_Glyph(*face, NUM2INT(glyph_index), NUM2INT(flags));
1272
1271
  if (err != FT_Err_Ok)
1273
1272
  handle_error(err);
@@ -1277,11 +1276,11 @@ static VALUE ft_face_load_glyph(VALUE self, VALUE glyph_index, VALUE flags) {
1277
1276
 
1278
1277
  /*
1279
1278
  * Load a glyph at a given size into a glyph slot of a FT2::Face object.
1280
- *
1279
+ *
1281
1280
  * Description:
1282
1281
  * Load a glyph at a given size into a glyph slot of a FT2::Face
1283
1282
  * object according to its character code.
1284
- *
1283
+ *
1285
1284
  * char_code: The glyph's character code, according to the current
1286
1285
  * charmap used in the FT2::Face object.
1287
1286
  * load_flags: A flag indicating what to load for this glyph. The
@@ -1289,7 +1288,7 @@ static VALUE ft_face_load_glyph(VALUE self, VALUE glyph_index, VALUE flags) {
1289
1288
  * glyph loading process (e.g., whether the outline should
1290
1289
  * be scaled, whether to load bitmaps or not, whether to
1291
1290
  * hint the outline, etc).
1292
- *
1291
+ *
1293
1292
  * Note:
1294
1293
  * If the face has no current charmap, or if the character code is not
1295
1294
  * defined in the charmap, this function will return an error.
@@ -1317,7 +1316,7 @@ static VALUE ft_face_load_glyph(VALUE self, VALUE glyph_index, VALUE flags) {
1317
1316
  * FT2::Load::FORCE_AUTOHINT
1318
1317
  * FT2::Load::NO_RECURSE
1319
1318
  * FT2::Load::PEDANTIC
1320
- *
1319
+ *
1321
1320
  * Examples:
1322
1321
  * face.load_char 5, FT2::Load::DEFAULT
1323
1322
  *
@@ -1342,9 +1341,9 @@ static VALUE ft_face_load_char(VALUE self, VALUE char_code, VALUE flags) {
1342
1341
  * the same as used in the font in case the font is based on glyph
1343
1342
  * indices. Reason for this behaviour is to assure that index 0 is
1344
1343
  * never used, representing the missing glyph.
1345
- *
1344
+ *
1346
1345
  * A return value of 0 means `undefined character code'.
1347
- *
1346
+ *
1348
1347
  * Examples:
1349
1348
  * index = face.char_index 65
1350
1349
  * puts 'undefined character code' if index == 0
@@ -1356,22 +1355,22 @@ static VALUE ft_face_char_index(VALUE self, VALUE char_code) {
1356
1355
  return INT2FIX(FT_Get_Char_Index(*face, NUM2INT(char_code)));
1357
1356
  }
1358
1357
 
1359
- /*
1358
+ /*
1360
1359
  * Get the glyph index of a given glyph name.
1361
1360
  *
1362
- * Note:
1361
+ * Note:
1363
1362
  * This method uses driver specific objects to do the translation.
1364
1363
  *
1365
1364
  * A return value of 0 means `undefined character code'.
1366
1365
  *
1367
1366
  * Examples:
1368
1367
  * index = face.name_index glyph_name
1369
- *
1368
+ *
1370
1369
  */
1371
1370
  static VALUE ft_face_name_index(VALUE self, VALUE glyph_name) {
1372
1371
  FT_Face *face;
1373
1372
  Data_Get_Struct(self, FT_Face, face);
1374
- return INT2FIX(FT_Get_Name_Index(*face, RSTRING(glyph_name)->ptr));
1373
+ return INT2FIX(FT_Get_Name_Index(*face, RSTRING_PTR(glyph_name)));
1375
1374
  }
1376
1375
 
1377
1376
  /*
@@ -1379,14 +1378,14 @@ static VALUE ft_face_name_index(VALUE self, VALUE glyph_name) {
1379
1378
  *
1380
1379
  * Description:
1381
1380
  * Get the kerning vector between two glyphs of a FT2::Face object.
1382
- *
1381
+ *
1383
1382
  * left_glyph: The index of the left glyph in the kern pair.
1384
1383
  * right_glyph: The index of the right glyph in the kern pair.
1385
1384
  * kern_mode: One of the FT2::KerningMode::XXXX constants. Determines
1386
1385
  * the scale/dimension of the returned kerning vector.
1387
- *
1386
+ *
1388
1387
  * Passing kern_mode == nil is the same as FT2::KerningMode::DEFAULT.
1389
- *
1388
+ *
1390
1389
  * Returns a kerning vector (actually a two-element array). This is in
1391
1390
  * font units for scalable formats, and in pixels for fixed-sizes
1392
1391
  * formats.
@@ -1416,21 +1415,21 @@ static VALUE ft_face_kerning(VALUE self, VALUE left_glyph, VALUE right_glyph, VA
1416
1415
 
1417
1416
  if (kern_mode == Qnil)
1418
1417
  kern_mode = NUM2INT(ft_kerning_default);
1419
-
1418
+
1420
1419
  err = FT_Get_Kerning(*face, NUM2INT(left_glyph), NUM2INT(right_glyph), NUM2INT(kern_mode), &v);
1421
1420
  if (err != FT_Err_Ok)
1422
1421
  handle_error(err);
1423
1422
 
1424
1423
  rb_ary_push(ary, INT2FIX(v.x));
1425
1424
  rb_ary_push(ary, INT2FIX(v.y));
1426
-
1425
+
1427
1426
  return ary;
1428
1427
  }
1429
1428
 
1430
1429
  /*
1431
1430
  * Get the ASCII name of a glyph in a FT2::Face object.
1432
1431
  *
1433
- * Note:
1432
+ * Note:
1434
1433
  * If the face doesn't provide glyph names or if the glyph index is
1435
1434
  * invalid, nil is returned. The glyph name is truncated if it is
1436
1435
  * longer than 1024 characters.
@@ -1455,7 +1454,7 @@ static VALUE ft_face_glyph_name(VALUE self, VALUE glyph_index) {
1455
1454
  /*
1456
1455
  * Get the ASCII Postscript name of a FT2::Face object.
1457
1456
  *
1458
- * Note:
1457
+ * Note:
1459
1458
  * This should only work with Postscript and TrueType fonts. If the
1460
1459
  * PostScript name is un-avaialble, nil is returned.
1461
1460
  *
@@ -1468,7 +1467,7 @@ static VALUE ft_face_ps_name(VALUE self) {
1468
1467
  FT_Face *face;
1469
1468
  const char *str;
1470
1469
  Data_Get_Struct(self, FT_Face, face);
1471
-
1470
+
1472
1471
  if ((str = FT_Get_Postscript_Name(*face)) != NULL)
1473
1472
  return rb_str_new2(str);
1474
1473
  else
@@ -1523,11 +1522,11 @@ static VALUE ft_face_set_charmap(VALUE self, VALUE charmap) {
1523
1522
 
1524
1523
  /*
1525
1524
  * Return the first character code of the selected charmap and corresponding glyph index of a FT2::Face object.
1526
- *
1525
+ *
1527
1526
  * Note:
1528
1527
  * Using this with FT2::Face#next_char will allow you to iterate
1529
1528
  * through the charmap => glyph index mapping for the selected
1530
- * charmap.
1529
+ * charmap.
1531
1530
  *
1532
1531
  * You should probably use the method FT2::Face#current_charmap
1533
1532
  * instead.
@@ -1557,7 +1556,7 @@ static VALUE ft_face_first_char(VALUE self) {
1557
1556
 
1558
1557
  /*
1559
1558
  * Return the next character code of the selected charmap and corresponding glyph index of a FT2::Face object.
1560
- *
1559
+ *
1561
1560
  * Note:
1562
1561
  * Using this with FT2::Face#first_char will allow you to iterate
1563
1562
  * through the charmap => glyph index mapping for the selected
@@ -1592,7 +1591,7 @@ static VALUE ft_face_next_char(VALUE self, VALUE char_code) {
1592
1591
 
1593
1592
  /*
1594
1593
  * Return the character code to glyph index map of the selected charmap of a FT2::Face object.
1595
- *
1594
+ *
1596
1595
  * Note:
1597
1596
  * Returns nil if the selected charmap is empty.
1598
1597
  *
@@ -1618,7 +1617,7 @@ static VALUE ft_face_current_charmap(VALUE self) {
1618
1617
  rb_hash_aset(rtn, UINT2NUM(c_code), UINT2NUM(g_idx));
1619
1618
  c_code = FT_Get_Next_Char(*face, c_code, &g_idx);
1620
1619
  }
1621
-
1620
+
1622
1621
  return rtn;
1623
1622
  }
1624
1623
 
@@ -1639,13 +1638,13 @@ static VALUE ft_glyphmetrics_init(VALUE self) {
1639
1638
  return self;
1640
1639
  }
1641
1640
 
1642
- /*
1641
+ /*
1643
1642
  * Get the glyph's width.
1644
1643
  *
1645
- * Note:
1644
+ * Note:
1646
1645
  * Values are expressed in 26.6 fractional pixel format or in font
1647
1646
  * units, depending on context.
1648
- *
1647
+ *
1649
1648
  * Aliases:
1650
1649
  * FT2::GlyphMetrics#w
1651
1650
  *
@@ -1660,13 +1659,13 @@ static VALUE ft_glyphmetrics_width(VALUE self) {
1660
1659
  return INT2NUM(glyph->width);
1661
1660
  }
1662
1661
 
1663
- /*
1662
+ /*
1664
1663
  * Get the glyph's height.
1665
1664
  *
1666
- * Note:
1665
+ * Note:
1667
1666
  * Values are expressed in 26.6 fractional pixel format or in font
1668
1667
  * units, depending on context.
1669
- *
1668
+ *
1670
1669
  * Aliases:
1671
1670
  * FT2::GlyphMetrics#h
1672
1671
  *
@@ -1681,13 +1680,13 @@ static VALUE ft_glyphmetrics_height(VALUE self) {
1681
1680
  return INT2NUM(glyph->height);
1682
1681
  }
1683
1682
 
1684
- /*
1683
+ /*
1685
1684
  * Get the glyph's left side bearing in horizontal layouts.
1686
1685
  *
1687
- * Note:
1686
+ * Note:
1688
1687
  * Values are expressed in 26.6 fractional pixel format or in font
1689
1688
  * units, depending on context.
1690
- *
1689
+ *
1691
1690
  * Aliases:
1692
1691
  * FT2::GlyphMetrics#horiBearingX
1693
1692
  * FT2::GlyphMetrics#h_bear_x
@@ -1706,13 +1705,13 @@ static VALUE ft_glyphmetrics_h_bear_x(VALUE self) {
1706
1705
  return INT2NUM(glyph->horiBearingX);
1707
1706
  }
1708
1707
 
1709
- /*
1708
+ /*
1710
1709
  * Get the glyph's top side bearing in horizontal layouts.
1711
1710
  *
1712
- * Note:
1711
+ * Note:
1713
1712
  * Values are expressed in 26.6 fractional pixel format or in font
1714
1713
  * units, depending on context.
1715
- *
1714
+ *
1716
1715
  * Aliases:
1717
1716
  * FT2::GlyphMetrics#horiBearingY
1718
1717
  * FT2::GlyphMetrics#h_bear_y
@@ -1731,13 +1730,13 @@ static VALUE ft_glyphmetrics_h_bear_y(VALUE self) {
1731
1730
  return INT2NUM(glyph->horiBearingY);
1732
1731
  }
1733
1732
 
1734
- /*
1733
+ /*
1735
1734
  * Get the glyph's advance width for horizontal layouts.
1736
1735
  *
1737
- * Note:
1736
+ * Note:
1738
1737
  * Values are expressed in 26.6 fractional pixel format or in font
1739
1738
  * units, depending on context.
1740
- *
1739
+ *
1741
1740
  * Aliases:
1742
1741
  * FT2::GlyphMetrics#horiAdvance
1743
1742
  * FT2::GlyphMetrics#ha
@@ -1754,13 +1753,13 @@ static VALUE ft_glyphmetrics_h_advance(VALUE self) {
1754
1753
  return INT2NUM(glyph->horiAdvance);
1755
1754
  }
1756
1755
 
1757
- /*
1756
+ /*
1758
1757
  * Get the glyph's left side bearing in vertical layouts.
1759
1758
  *
1760
- * Note:
1759
+ * Note:
1761
1760
  * Values are expressed in 26.6 fractional pixel format or in font
1762
1761
  * units, depending on context.
1763
- *
1762
+ *
1764
1763
  * Aliases:
1765
1764
  * FT2::GlyphMetrics#vertBearingX
1766
1765
  * FT2::GlyphMetrics#v_bear_x
@@ -1779,13 +1778,13 @@ static VALUE ft_glyphmetrics_v_bear_x(VALUE self) {
1779
1778
  return INT2NUM(glyph->vertBearingX);
1780
1779
  }
1781
1780
 
1782
- /*
1781
+ /*
1783
1782
  * Get the glyph's top side bearing in vertical layouts.
1784
1783
  *
1785
- * Note:
1784
+ * Note:
1786
1785
  * Values are expressed in 26.6 fractional pixel format or in font
1787
1786
  * units, depending on context.
1788
- *
1787
+ *
1789
1788
  * Aliases:
1790
1789
  * FT2::GlyphMetrics#vertBearingY
1791
1790
  * FT2::GlyphMetrics#v_bear_y
@@ -1804,13 +1803,13 @@ static VALUE ft_glyphmetrics_v_bear_y(VALUE self) {
1804
1803
  return INT2NUM(glyph->vertBearingY);
1805
1804
  }
1806
1805
 
1807
- /*
1806
+ /*
1808
1807
  * Get the glyph's advance width for vertical layouts.
1809
1808
  *
1810
- * Note:
1809
+ * Note:
1811
1810
  * Values are expressed in 26.6 fractional pixel format or in font
1812
1811
  * units, depending on context.
1813
- *
1812
+ *
1814
1813
  * Aliases:
1815
1814
  * FT2::GlyphMetrics#vertAdvance
1816
1815
  * FT2::GlyphMetrics#va
@@ -1863,7 +1862,7 @@ static VALUE ft_glyphslot_init(VALUE self) {
1863
1862
  * Render Modes:
1864
1863
  * FT2::RenderMode::NORMAL
1865
1864
  * FT2::RenderMode::MONO
1866
- *
1865
+ *
1867
1866
  * Examples:
1868
1867
  * slot.render FT2::RenderMode::NORMAL
1869
1868
  *
@@ -1875,7 +1874,7 @@ static VALUE ft_glyphslot_render(VALUE self, VALUE render_mode) {
1875
1874
  Data_Get_Struct(self, FT_GlyphSlot, glyph);
1876
1875
  if (render_mode == Qnil)
1877
1876
  render_mode = INT2FIX(ft_render_mode_normal);
1878
-
1877
+
1879
1878
  err = FT_Render_Glyph(*glyph, NUM2INT(render_mode));
1880
1879
  if (err != FT_Err_Ok)
1881
1880
  handle_error(err);
@@ -1931,7 +1930,7 @@ static VALUE ft_glyphslot_face(VALUE self) {
1931
1930
  Data_Get_Struct(self, FT_GlyphSlot, glyph);
1932
1931
  face = malloc(sizeof(FT_Face));
1933
1932
  *face = (*glyph)->face;
1934
-
1933
+
1935
1934
  /* do we really want to dont_free() cb here? */
1936
1935
  return Data_Wrap_Struct(cFace, 0, dont_free, face);
1937
1936
  }
@@ -1956,7 +1955,7 @@ static VALUE ft_glyphslot_next(VALUE self) {
1956
1955
  Data_Get_Struct(self, FT_GlyphSlot, glyph);
1957
1956
  next = malloc(sizeof(FT_GlyphSlot));
1958
1957
  *next = (*glyph)->next;
1959
-
1958
+
1960
1959
  /* do we really want to dont_free() cb here? */
1961
1960
  return Data_Wrap_Struct(cGlyphSlot, 0, dont_free, next);
1962
1961
  }
@@ -1975,7 +1974,7 @@ static VALUE ft_glyphslot_metrics(VALUE self) {
1975
1974
  Data_Get_Struct(self, FT_GlyphSlot, glyph);
1976
1975
  metrics = malloc(sizeof(FT_Glyph_Metrics));
1977
1976
  *metrics = (*glyph)->metrics;
1978
-
1977
+
1979
1978
  return Data_Wrap_Struct(cGlyphMetrics, 0, dont_free, metrics);
1980
1979
  }
1981
1980
 
@@ -1987,7 +1986,7 @@ static VALUE ft_glyphslot_metrics(VALUE self) {
1987
1986
  * horizontal advance width for the FT2:GlyphSlot (i.e. the scaled and
1988
1987
  * unhinted value of the hori advance). This can be important to
1989
1988
  * perform correct WYSIWYG layout.
1990
- *
1989
+ *
1991
1990
  * Note:
1992
1991
  * The return value is expressed by default in 16.16 pixels. However,
1993
1992
  * when the FT2::GlyphSlot is loaded with the FT2::Load::LINEAR_DESIGN
@@ -2018,7 +2017,7 @@ static VALUE ft_glyphslot_h_advance(VALUE self) {
2018
2017
  * vertical advance height for the FT2:GlyphSlot (i.e. the scaled and
2019
2018
  * unhinted value of the hori advance). This can be important to
2020
2019
  * perform correct WYSIWYG layout.
2021
- *
2020
+ *
2022
2021
  * Note:
2023
2022
  * The return value is expressed by default in 16.16 pixels. However,
2024
2023
  * when the FT2::GlyphSlot is loaded with the FT2::Load::LINEAR_DESIGN
@@ -2093,14 +2092,14 @@ static VALUE ft_glyphslot_bitmap(VALUE self) {
2093
2092
  Data_Get_Struct(self, FT_GlyphSlot, glyph);
2094
2093
  bitmap = malloc(sizeof(FT_Bitmap));
2095
2094
  *bitmap = (*glyph)->bitmap;
2096
-
2095
+
2097
2096
  return Data_Wrap_Struct(cBitmap, 0, dont_free, bitmap);
2098
2097
  }
2099
2098
 
2100
2099
  /*
2101
2100
  * Get the left bearing (in pixels) of a bitmap format FT2::GlyphSlot object.
2102
2101
  *
2103
- * Note:
2102
+ * Note:
2104
2103
  * Only valid if the format is FT2::GlyphFormat::BITMAP.
2105
2104
  *
2106
2105
  * Examples:
@@ -2116,7 +2115,7 @@ static VALUE ft_glyphslot_bitmap_left(VALUE self) {
2116
2115
  /*
2117
2116
  * Get the top bearing (in pixels) of a bitmap format FT2::GlyphSlot object.
2118
2117
  *
2119
- * Note:
2118
+ * Note:
2120
2119
  * Only valid if the format is FT2::GlyphFormat::BITMAP. The value
2121
2120
  * returned is the distance from the baseline to the topmost glyph
2122
2121
  * scanline, upwards y-coordinates being positive.
@@ -2148,7 +2147,7 @@ static VALUE ft_glyphslot_outline(VALUE self) {
2148
2147
  Data_Get_Struct(self, FT_GlyphSlot, glyph);
2149
2148
  outline = malloc(sizeof(FT_Outline));
2150
2149
  *outline = (*glyph)->outline;
2151
-
2150
+
2152
2151
  return Data_Wrap_Struct(cOutline, 0, dont_free, outline);
2153
2152
  }
2154
2153
 
@@ -2190,12 +2189,12 @@ static VALUE ft_glyphslot_subglyphs(VALUE self) {
2190
2189
 
2191
2190
  /* FIXME: this probably doesn't work */
2192
2191
  rtn = rb_ary_new();
2193
- /*
2192
+ /*
2194
2193
  * for (i = 0; i < num; i++)
2195
2194
  * rb_ary_push(rtn, Data_Wrap_Struct(cSubGlyph, 0,
2196
2195
  * dont_free,
2197
2196
  * (*glyph)->subglyphs[i]));
2198
- */
2197
+ */
2199
2198
  return rtn;
2200
2199
  }
2201
2200
 
@@ -2339,8 +2338,8 @@ static VALUE ft_size_metrics_y_ppem(VALUE self) {
2339
2338
  *
2340
2339
  * Description:
2341
2340
  * Scale that is used to directly scale horizontal distances from
2342
- * design space to 1/64th of device pixels.
2343
- *
2341
+ * design space to 1/64th of device pixels.
2342
+ *
2344
2343
  * Examples:
2345
2344
  * x_scale = face.size.metrics.x_scale
2346
2345
  *
@@ -2356,8 +2355,8 @@ static VALUE ft_size_metrics_x_scale(VALUE self) {
2356
2355
  *
2357
2356
  * Description:
2358
2357
  * Scale that is used to directly scale vertical distances from
2359
- * design space to 1/64th of device pixels.
2360
- *
2358
+ * design space to 1/64th of device pixels.
2359
+ *
2361
2360
  * Examples:
2362
2361
  * y_scale = face.size.metrics.y_scale
2363
2362
  *
@@ -2393,8 +2392,8 @@ static VALUE ft_glyph_init(VALUE self) {
2393
2392
 
2394
2393
  /*
2395
2394
  * Get the library of a FT2::Glyph object.
2396
- *
2397
- * Note:
2395
+ *
2396
+ * Note:
2398
2397
  * Glyph objects are not owned or tracked by the library.
2399
2398
  *
2400
2399
  * Examples:
@@ -2409,7 +2408,7 @@ static VALUE ft_glyph_library(VALUE self) {
2409
2408
 
2410
2409
  /*
2411
2410
  * Get the FreeType2 class of a FT2::Glyph object.
2412
- *
2411
+ *
2413
2412
  * Note:
2414
2413
  * This is _not_ the Ruby class of the object.
2415
2414
  *
@@ -2428,7 +2427,7 @@ static VALUE ft_glyph_class(VALUE self) {
2428
2427
 
2429
2428
  /*
2430
2429
  * Get the format of a FT2::Glyph object's image.
2431
- *
2430
+ *
2432
2431
  * Glyph Formats:
2433
2432
  * FT2::GlyphFormat::COMPOSITE
2434
2433
  * FT2::GlyphFormat::BITMAP
@@ -2447,7 +2446,7 @@ static VALUE ft_glyph_format(VALUE self) {
2447
2446
 
2448
2447
  /*
2449
2448
  * Get the advance of a FT2::Glyph object.
2450
- *
2449
+ *
2451
2450
  * Description:
2452
2451
  * This vector gives the FT2::Glyph object's advance width.
2453
2452
  *
@@ -2486,23 +2485,23 @@ static VALUE ft_glyph_dup(VALUE self) {
2486
2485
  err = FT_Glyph_Copy(*glyph, new_glyph);
2487
2486
  if (err != FT_Err_Ok)
2488
2487
  handle_error(err);
2489
-
2488
+
2490
2489
  return Data_Wrap_Struct(cGlyph, 0, glyph_free, new_glyph);
2491
2490
  }
2492
2491
 
2493
2492
  /*
2494
2493
  * Transform a FT2::Glyph object if it's format is scalable.
2495
- *
2494
+ *
2496
2495
  * Description:
2497
2496
  * matrix: A pointer to a 2x2 matrix to apply.
2498
2497
  * delta: A pointer to a 2d vector to apply. Coordinates are
2499
2498
  * expressed in 1/64th of a pixel.
2500
- *
2499
+ *
2501
2500
  * Note:
2502
2501
  * The transformation matrix is also applied to the glyph's advance
2503
2502
  * vector. This method returns an error if the glyph format is not
2504
2503
  * scalable (eg, if it's not equal to zero).
2505
- *
2504
+ *
2506
2505
  * Examples:
2507
2506
  * matrix = [[1, 0],
2508
2507
  * [0, 1]]
@@ -2528,7 +2527,7 @@ static VALUE ft_glyph_transform(VALUE self, VALUE matrix_ary, VALUE delta_ary) {
2528
2527
  err = FT_Glyph_Transform(*glyph, &matrix, &delta);
2529
2528
  if (err != FT_Err_Ok)
2530
2529
  handle_error(err);
2531
-
2530
+
2532
2531
  return self;
2533
2532
  }
2534
2533
 
@@ -2546,7 +2545,7 @@ static VALUE ft_glyph_transform(VALUE self, VALUE matrix_ary, VALUE delta_ary) {
2546
2545
  * box can take much more time as it needs to walk over all segments
2547
2546
  * and arcs in the outline. To get the latter, you can use the
2548
2547
  * `ftbbox' component which is dedicated to this single task.
2549
- *
2548
+ *
2550
2549
  * Notes:
2551
2550
  * Coordinates are relative to the FT2::Glyph object's origin, using
2552
2551
  * the Y-upwards convention.
@@ -2579,7 +2578,7 @@ static VALUE ft_glyph_transform(VALUE self, VALUE matrix_ary, VALUE delta_ary) {
2579
2578
  * to FT2::GlyphBBox::PIXELS.
2580
2579
  *
2581
2580
  * The default value for `bbox_mode' is FT2::GlyphBBox::PIXELS.
2582
- *
2581
+ *
2583
2582
  * Aliases:
2584
2583
  * FT2::Glyph#control_box
2585
2584
  *
@@ -2601,7 +2600,7 @@ static VALUE ft_glyph_cbox(VALUE self, VALUE bbox_mode) {
2601
2600
  rb_ary_push(ary, INT2FIX(bbox.yMin));
2602
2601
  rb_ary_push(ary, INT2FIX(bbox.xMax));
2603
2602
  rb_ary_push(ary, INT2FIX(bbox.yMax));
2604
-
2603
+
2605
2604
  return ary;
2606
2605
  }
2607
2606
 
@@ -2610,7 +2609,7 @@ static VALUE ft_glyph_cbox(VALUE self, VALUE bbox_mode) {
2610
2609
  *
2611
2610
  * Description:
2612
2611
  * Converts a FT2::Glyph object to a FT2::BitmapGlyph object.
2613
- *
2612
+ *
2614
2613
  * render_mode: A set of bit flags that describe how the data is.
2615
2614
  * origin: A vector used to translate the glyph image before
2616
2615
  * rendering. Can be nil (if no translation). The
@@ -2618,7 +2617,7 @@ static VALUE ft_glyph_cbox(VALUE self, VALUE bbox_mode) {
2618
2617
  * destroy: A boolean that indicates that the original glyph
2619
2618
  * image should be destroyed by this function. It is
2620
2619
  * never destroyed in case of error.
2621
- *
2620
+ *
2622
2621
  * Aliases:
2623
2622
  * FT2::Glyph#to_bitmap
2624
2623
  *
@@ -2668,13 +2667,13 @@ static VALUE ft_bmapglyph_init(VALUE self) {
2668
2667
  * The top-side bearing, i.e., the vertical distance from the current
2669
2668
  * pen position to the top border of the glyph bitmap. This distance
2670
2669
  * is positive for upwards-y.
2671
- *
2670
+ *
2672
2671
  * Note:
2673
2672
  * FT2::BitmapGlyph is a subclass of FT2::Glyph.
2674
2673
  *
2675
2674
  * Examples:
2676
2675
  * y = bmap_glyph.top
2677
- *
2676
+ *
2678
2677
  */
2679
2678
  static VALUE ft_bmapglyph_top(VALUE self) {
2680
2679
  FT_BitmapGlyph *glyph;
@@ -2688,13 +2687,13 @@ static VALUE ft_bmapglyph_top(VALUE self) {
2688
2687
  * Description:
2689
2688
  * The left-side bearing, i.e., the horizontal distance from the
2690
2689
  * current pen position to the left border of the glyph bitmap.
2691
- *
2690
+ *
2692
2691
  * Note:
2693
2692
  * FT2::BitmapGlyph is a subclass of FT2::Glyph.
2694
2693
  *
2695
2694
  * Examples:
2696
2695
  * x = bmap_glyph.left
2697
- *
2696
+ *
2698
2697
  */
2699
2698
  static VALUE ft_bmapglyph_left(VALUE self) {
2700
2699
  FT_BitmapGlyph *glyph;
@@ -2865,12 +2864,10 @@ void Init_ft2(void) {
2865
2864
  /* define top-level FT2 module */
2866
2865
  mFt2 = rb_define_module("FT2");
2867
2866
 
2868
- /* define FT2::VERSION */
2869
- rb_define_const(mFt2, "VERSION", rb_str_new2(VERSION));
2870
2867
  rb_define_singleton_method(mFt2, "version", ft_version, 0);
2871
-
2868
+
2872
2869
  define_constants();
2873
-
2870
+
2874
2871
  /****************************/
2875
2872
  /* define FT2::Bitmap class */
2876
2873
  /****************************/
@@ -2902,10 +2899,10 @@ void Init_ft2(void) {
2902
2899
 
2903
2900
  rb_define_method(cFace, "faces", ft_face_faces, 0);
2904
2901
  rb_define_alias(cFace, "num_faces", "faces");
2905
-
2902
+
2906
2903
  rb_define_method(cFace, "index", ft_face_index, 0);
2907
2904
  rb_define_alias(cFace, "face_index", "index");
2908
-
2905
+
2909
2906
  rb_define_method(cFace, "flags", ft_face_flags, 0);
2910
2907
  rb_define_alias(cFace, "face_flags", "flags");
2911
2908
 
@@ -2920,7 +2917,7 @@ void Init_ft2(void) {
2920
2917
  rb_define_const(cFace, "GLYPH_NAMES", INT2FIX(FT_FACE_FLAG_GLYPH_NAMES));
2921
2918
  rb_define_const(cFace, "EXTERNAL_STREAM", INT2FIX(FT_FACE_FLAG_EXTERNAL_STREAM));
2922
2919
  rb_define_const(cFace, "FAST_GLYPHS", INT2FIX(FT_FACE_FLAG_FAST_GLYPHS));
2923
-
2920
+
2924
2921
  rb_define_method(cFace, "scalable?", ft_face_flag_scalable, 0);
2925
2922
  rb_define_method(cFace, "fixed_sizes?", ft_face_flag_fixed_sizes, 0);
2926
2923
  rb_define_method(cFace, "fixed_width?", ft_face_flag_fixed_width, 0);
@@ -2930,15 +2927,15 @@ void Init_ft2(void) {
2930
2927
  rb_define_method(cFace, "kerning?", ft_face_flag_kerning, 0);
2931
2928
  rb_define_method(cFace, "external_stream?", ft_face_flag_external_stream, 0);
2932
2929
  rb_define_method(cFace, "fast_glyphs?", ft_face_flag_fast_glyphs, 0);
2933
-
2930
+
2934
2931
  rb_define_method(cFace, "style_flags", ft_face_style_flags, 0);
2935
-
2932
+
2936
2933
  rb_define_const(cFace, "BOLD", INT2FIX(FT_STYLE_FLAG_BOLD));
2937
2934
  rb_define_const(cFace, "ITALIC", INT2FIX(FT_STYLE_FLAG_ITALIC));
2938
2935
 
2939
2936
  rb_define_method(cFace, "bold?", ft_face_flag_bold, 0);
2940
2937
  rb_define_method(cFace, "italic?", ft_face_flag_italic, 0);
2941
-
2938
+
2942
2939
  rb_define_method(cFace, "glyphs", ft_face_glyphs, 0);
2943
2940
  rb_define_alias(cFace, "num_glyphs", "glyphs");
2944
2941
 
@@ -2950,10 +2947,10 @@ void Init_ft2(void) {
2950
2947
 
2951
2948
  rb_define_method(cFace, "available_sizes", ft_face_available_sizes, 0);
2952
2949
  rb_define_alias(cFace, "num_available_sizes", "available_sizes");
2953
-
2950
+
2954
2951
  rb_define_method(cFace, "num_charmaps", ft_face_num_charmaps, 0);
2955
2952
  rb_define_method(cFace, "charmaps", ft_face_charmaps, 0);
2956
-
2953
+
2957
2954
  rb_define_method(cFace, "bbox", ft_face_bbox, 0);
2958
2955
 
2959
2956
  rb_define_method(cFace, "units_per_em", ft_face_units_per_em, 0);
@@ -2978,10 +2975,10 @@ void Init_ft2(void) {
2978
2975
 
2979
2976
  rb_define_method(cFace, "char_index", ft_face_char_index, 1);
2980
2977
  rb_define_method(cFace, "name_index", ft_face_name_index, 1);
2981
-
2978
+
2982
2979
  rb_define_method(cFace, "kerning", ft_face_kerning, 3);
2983
2980
  rb_define_alias(cFace, "get_kerning", "kerning");
2984
-
2981
+
2985
2982
  rb_define_method(cFace, "glyph_name", ft_face_glyph_name, 1);
2986
2983
  rb_define_method(cFace, "postscript_name", ft_face_ps_name, 0);
2987
2984
  rb_define_alias(cFace, "name", "postscript_name");
@@ -2989,12 +2986,12 @@ void Init_ft2(void) {
2989
2986
  rb_define_method(cFace, "select_charmap", ft_face_select_charmap, 1);
2990
2987
  rb_define_method(cFace, "set_charmap", ft_face_set_charmap, 1);
2991
2988
  rb_define_alias(cFace, "charmap=", "set_charmap");
2992
-
2989
+
2993
2990
  rb_define_method(cFace, "first_char", ft_face_first_char, 0);
2994
2991
  rb_define_method(cFace, "next_char", ft_face_next_char, 1);
2995
-
2992
+
2996
2993
  rb_define_method(cFace, "current_charmap", ft_face_current_charmap, 0);
2997
-
2994
+
2998
2995
  rb_define_method(cFace, "set_char_size", ft_face_set_char_size, 4);
2999
2996
  rb_define_method(cFace, "set_pixel_sizes", ft_face_set_pixel_sizes, 2);
3000
2997
  rb_define_method(cFace, "set_transform", ft_face_set_transform, 2);
@@ -3054,7 +3051,7 @@ void Init_ft2(void) {
3054
3051
  rb_define_alias(cGlyphSlot, "linearVertAdvance", "h_advance");
3055
3052
  rb_define_alias(cGlyphSlot, "v_adv", "h_advance");
3056
3053
  rb_define_alias(cGlyphSlot, "va", "h_advance");
3057
-
3054
+
3058
3055
  rb_define_method(cGlyphSlot, "advance", ft_glyphslot_advance, 0);
3059
3056
  rb_define_method(cGlyphSlot, "format", ft_glyphslot_format, 0);
3060
3057
  rb_define_method(cGlyphSlot, "bitmap", ft_glyphslot_bitmap, 0);
@@ -3065,7 +3062,7 @@ void Init_ft2(void) {
3065
3062
  rb_define_method(cGlyphSlot, "subglyphs", ft_glyphslot_subglyphs, 0);
3066
3063
  rb_define_method(cGlyphSlot, "control_data", ft_glyphslot_control_data, 0);
3067
3064
  rb_define_method(cGlyphSlot, "control_len", ft_glyphslot_control_len, 0);
3068
-
3065
+
3069
3066
  rb_define_method(cGlyphSlot, "render", ft_glyphslot_render, 1);
3070
3067
  rb_define_alias(cGlyphSlot, "render_glyph", "render");
3071
3068
 
@@ -3076,12 +3073,12 @@ void Init_ft2(void) {
3076
3073
  /* define FT2::Library class */
3077
3074
  /*****************************/
3078
3075
  cLibrary = rb_define_class_under(mFt2, "Library", rb_cObject);
3079
-
3076
+
3080
3077
  /****************************/
3081
3078
  /* define FT2::Memory class */
3082
3079
  /****************************/
3083
3080
  cMemory = rb_define_class_under(mFt2, "Memory", rb_cObject);
3084
-
3081
+
3085
3082
  /*****************************/
3086
3083
  /* define FT2::Outline class */
3087
3084
  /*****************************/