Skip to content

Commit b772696

Browse files
committed
initial commit.
0 parents  commit b772696

File tree

9 files changed

+3354
-0
lines changed

9 files changed

+3354
-0
lines changed

ChangeLog

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Thu Aug 15 09:39:24 2002, pabs <[email protected]>
2+
* created changelog.
3+
4+
Tue Nov 12 17:20:23 2002, pabs <[email protected]
5+
* made some changes according to the notes in the freetype2 headers:
6+
* ft2.c: removed FT2::PixelMode::RGB and FT2::PixelMode::RGBA constants
7+
* ft2.c: removed Ft2::PaletteMode
8+
* compiles clean with -W -Wall -pedantic again
9+
10+
Fri Nov 15 03:27:50 2002, pabs <[email protected]
11+
* ft2.c: finished documentation for FT2::Face methods.
12+
13+
Fri Nov 15 03:52:46 2002, pabs <[email protected]
14+
* ft2.c: added FT2::Face#current_charmap
15+
16+
Fri Nov 15 15:15:37 2002, pabs <[email protected]
17+
* ft2.c: finished documentation for FT2::GlyphMetrics methods.
18+
19+
Sat Nov 16 01:45:42 2002, pabs <[email protected]
20+
* ft2.c: finished documentation for FT2::GlyphSlot methods.
21+
22+
Wed Nov 20 16:11:10 2002, pabs <[email protected]
23+
* ft2.c: finished documenting the FT2::SizeMetrics methods (had to
24+
pull the documentation for them out of the second part of the
25+
FreeType2 tutorial, since they're not available in the API
26+
reference).
27+
28+
Thu Nov 21 15:18:26 2002, pabs <[email protected]
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

MANIFEST

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
./README
2+
./ft2.c
3+
./extconf.rb
4+
./examples/name_list.rb
5+
./examples/test_ft2.rb
6+
./examples/fonts/CVS/Root
7+
./examples/fonts/CVS/Repository
8+
./examples/fonts/CVS/Entries
9+
./examples/fonts/yudit.ttf
10+
./examples/.test_ft2.rb.swp
11+
./MANIFEST
12+
./TODO
13+
./tags
14+
./ChangeLog

README

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FT2-Ruby 0.1.0 README
2+
=====================
3+
4+
This document was last updated on Sat Nov 16 17:51:41 2002. Please see
5+
http://www.pablotron.org/software/ft2-ruby/ for the latest version of
6+
this software.
7+
8+
Introduction
9+
============
10+
hum de dum dum
11+
12+
Installing FT2-Ruby
13+
===================
14+
blah de blah blah
15+
16+
About the Author
17+
================
18+
Paul Duncan <[email protected]>
19+
http://www.pablotron.org/

TODO

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* fixed point data conversions
2+
* face subglyph handling
3+
* test test test test!

examples/fonts/yudit.ttf

56.4 KB
Binary file not shown.

examples/name_list.rb

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/usr/bin/env ruby
2+
3+
$FONTDIR = '/usr/X11R6/lib/X11/fonts/truetype'
4+
5+
require 'readline'
6+
require 'ft2'
7+
8+
$commands = {
9+
'quit' => 'Quit program.',
10+
'list' => 'List all fonts.',
11+
'help' => 'Print this list of commands.',
12+
}
13+
$fonts = {}
14+
15+
def tab_complete(str)
16+
($commands.keys.map { |i| i =~ /^#{str}/i ? i : nil }.compact! || []) +
17+
$fonts.keys.map { |i| i =~ /^#{str}/i ? i : nil }.compact!
18+
end
19+
20+
def show_font_info(str)
21+
path, face = $fonts[str]
22+
if path and face
23+
puts 'Name: ' << face.name,
24+
'Path: ' << path,
25+
'Family: ' << face.family,
26+
'Style: ' << face.style,
27+
'Bold: ' << face.bold?.to_s,
28+
'Italic: ' << face.italic?.to_s,
29+
'Scalable: ' << face.scalable?.to_s,
30+
'Horizontal: ' << face.horizontal?.to_s,
31+
'Vertical: ' << face.vertical?.to_s,
32+
'Kerning: ' << face.kerning?.to_s,
33+
'Fast Glyphs: ' << face.fast_glyphs?.to_s,
34+
'Num Glyphs: ' << face.num_glyphs.to_s,
35+
'Num Charmaps: ' << face.num_charmaps.to_s
36+
37+
else
38+
$stderr.puts "Unknown font \"#{str}\""
39+
end
40+
end
41+
42+
count = 0
43+
Dir["#$FONTDIR/*"].each { |i|
44+
count += 1
45+
next if i =~ /^\./
46+
begin
47+
face = FT2::Face.load(i)
48+
rescue Exception
49+
next
50+
end
51+
# puts [face, face.name, face.num_glyphs ].join ', '
52+
$fonts[face.name] = [i, face]
53+
}
54+
puts "Loaded #{$fonts.keys.size} of #{count} fonts."
55+
56+
# Readline::completion_case_fold = true
57+
Readline::completion_proc = Proc.new { |str| tab_complete(str) }
58+
59+
done = false
60+
until done
61+
line = Readline::readline '> ', true
62+
63+
case line
64+
when %r|^q(uit)?|
65+
done = true
66+
when %r|^h(elp)?|
67+
$commands.keys.sort { |a, b| a <=> b }.each { |key|
68+
puts "#{key}: #{$commands[key]}"
69+
}
70+
when %r|^l(ist\|s)?|
71+
$fonts.each { |key, val|
72+
path, face = val
73+
puts [key, face.num_glyphs].join ', '
74+
}
75+
when /^$/
76+
next
77+
else
78+
show_font_info(line.strip)
79+
end
80+
end

examples/test_ft2.rb

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env ruby
2+
3+
require 'ft2'
4+
5+
puts FT2::version
6+
puts FT2::VERSION
7+
8+
face = FT2::Face.new 'fonts/yudit.ttf'
9+
puts "glyphs: #{face.glyphs}",
10+
"charmaps: #{face.num_charmaps}",
11+
"horiz: #{face.horizontal?}",
12+
"vert: #{face.vertical?}"
13+
14+
# cycle through default charmap
15+
puts 'listing character codes with first_char/next_char'
16+
c_code, g_idx = face.first_char
17+
while g_idx != 0
18+
puts "#{c_code} => " << face.glyph_name(g_idx)
19+
c_code, g_idx = face.next_char c_code
20+
end
21+
22+
puts 'listing charcodes with current_charmap'
23+
24+
cmap = face.current_charmap
25+
cmap.keys.sort.each { |c_code|
26+
puts "#{c_code} => " << face.glyph_name(cmap[c_code])
27+
}

extconf.rb

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
require 'mkmf'
2+
3+
ft2_config = with_config("freetype-config", "freetype-config")
4+
5+
$CFLAGS << ' ' << `#{ft2_config} --cflags`.chomp
6+
$LDFLAGS << ' ' << `#{ft2_config} --libs`.chomp
7+
8+
have_library("freetype", "FT_Init_FreeType") and
9+
create_makefile("ft2")
10+

0 commit comments

Comments
 (0)