#--
-# $Id: part.rb 32 2005-04-24 09:18:07Z tilman $
+# $Id: part.rb 45 2005-06-08 18:02:12Z tilman $
#
# Copyright (c) 2005 Tilman Sauerbeck (tilman at code-monkey de)
#
f = f.to_str.strip
md = f.match(/.*\.ttf$/)
unless md.nil?
- found = EDJE.font_dir.find { |font| font.filename == f }
+ f2 = find_font(f)
+ raise(RedactError, "cannot find font - #{f}") if f2.nil?
+
+ found = EDJE.font_dir.find { |font| font.filename == f2 }
if found.nil?
- EDJE.font_dir << FontDirectoryEntry.new(f)
+ EDJE.font_dir << FontDirectoryEntry.new(f2)
+ @font = EDJE.font_dir.last.filename
end
+ else
+ @font = f
end
-
- @font = f
end
def outline_color=(c)
"text.id_source" => [@text_id_source],
"text.id_text_source" => [@text_id_text_source]})
end
+
+ private
+ def find_font(file)
+ [".", OPTIONS.font_dir].each do |d|
+ f2 = File.join(d, file)
+ return Pathname.new(f2).cleanpath.to_s if File.file?(f2)
+ end
+
+ nil
+ end
end
end