[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r3965 - in trunk/pingus: data/images/fonts src
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r3965 - in trunk/pingus: data/images/fonts src |
Date: |
Wed, 25 Feb 2009 21:00:14 +0100 |
Author: grumbel
Date: 2009-02-25 21:00:08 +0100 (Wed, 25 Feb 2009)
New Revision: 3965
Modified:
trunk/pingus/data/images/fonts/chalk-16px.font
trunk/pingus/data/images/fonts/chalk-20px.font
trunk/pingus/data/images/fonts/chalk-40px.font
trunk/pingus/data/images/fonts/pingus-small-20px.font
trunk/pingus/data/images/fonts/verdana11.font
trunk/pingus/src/font.cpp
trunk/pingus/src/font_description.cpp
trunk/pingus/src/font_description.hpp
Log:
Added support for multiple images per font (half done)
Modified: trunk/pingus/data/images/fonts/chalk-16px.font
===================================================================
--- trunk/pingus/data/images/fonts/chalk-16px.font 2009-02-25 19:42:46 UTC
(rev 3964)
+++ trunk/pingus/data/images/fonts/chalk-16px.font 2009-02-25 20:00:08 UTC
(rev 3965)
@@ -1,8 +1,10 @@
(pingus-font
- (size 16)
- (image "images/fonts/chalk-16px.png")
- (glyph-count 533)
- (glyphs
+ (size 16)
+ (glyph-count 533)
+ (images
+ (image
+ (filename "images/fonts/chalk-16px.png")
+ (glyphs
(glyph (unicode 506) (offset 0 -19) (advance 12) (rect 0 0 14 23))
(glyph (unicode 471) (offset 0 -20) (advance 8) (rect 14 0 24 23))
(glyph (unicode 475) (offset 0 -20) (advance 8) (rect 24 0 34 23))
@@ -538,5 +540,5 @@
(glyph (unicode 167) (offset 0 0) (advance 12) (rect 37 340 39 342))
(glyph (unicode 182) (offset 0 0) (advance 12) (rect 39 340 41 342))
(glyph (unicode 32) (offset 0 0) (advance 5) (rect 41 340 43 342))
- ))
+ ))))
;; EOF ;;
Modified: trunk/pingus/data/images/fonts/chalk-20px.font
===================================================================
--- trunk/pingus/data/images/fonts/chalk-20px.font 2009-02-25 19:42:46 UTC
(rev 3964)
+++ trunk/pingus/data/images/fonts/chalk-20px.font 2009-02-25 20:00:08 UTC
(rev 3965)
@@ -1,9 +1,11 @@
(pingus-font
- (size 20)
- (image "images/fonts/chalk-20px.png")
- (glyph-count 533)
- (vertical-spacing 1.4)
- (glyphs
+ (size 20)
+ (glyph-count 533)
+ (vertical-spacing 1.4)
+ (images
+ (image
+ (filename "images/fonts/chalk-20px.png")
+ (glyphs
(glyph (unicode 506) (offset 0 -24) (advance 14) (rect 0 0 14 26))
(glyph (unicode 471) (offset 0 -25) (advance 10) (rect 14 0 24 26))
(glyph (unicode 475) (offset 0 -25) (advance 10) (rect 24 0 34 26))
@@ -539,5 +541,5 @@
(glyph (unicode 182) (offset 0 0) (advance 14) (rect 57 182 57 182))
(glyph (unicode 167) (offset 0 0) (advance 14) (rect 57 182 57 182))
(glyph (unicode 160) (offset 0 0) (advance 6) (rect 57 182 57 182))
- ))
+ ))))
;; EOF ;;
Modified: trunk/pingus/data/images/fonts/chalk-40px.font
===================================================================
--- trunk/pingus/data/images/fonts/chalk-40px.font 2009-02-25 19:42:46 UTC
(rev 3964)
+++ trunk/pingus/data/images/fonts/chalk-40px.font 2009-02-25 20:00:08 UTC
(rev 3965)
@@ -1,8 +1,10 @@
(pingus-font
- (image "images/fonts/chalk-40px.png")
- (size 40)
- (glyph-count 533)
- (glyphs
+ (size 40)
+ (glyph-count 533)
+ (images
+ (image
+ (filename "images/fonts/chalk-40px.png")
+ (glyphs
(glyph (unicode 475) (offset 0 -48) (advance 21) (rect 0 0 20 50))
(glyph (unicode 471) (offset 0 -48) (advance 21) (rect 20 0 40 50))
(glyph (unicode 309) (offset 0 -35) (advance 14) (rect 40 0 58 50))
@@ -538,6 +540,6 @@
(glyph (unicode 182) (offset 0 0) (advance 29) (rect 788 329 788 329))
(glyph (unicode 32) (offset 0 0) (advance 12) (rect 788 329 788 329))
(glyph (unicode 13) (offset 0 0) (advance 13) (rect 788 329 788 329))
- ))
+ ))))
;; EOF ;;
Modified: trunk/pingus/data/images/fonts/pingus-small-20px.font
===================================================================
--- trunk/pingus/data/images/fonts/pingus-small-20px.font 2009-02-25
19:42:46 UTC (rev 3964)
+++ trunk/pingus/data/images/fonts/pingus-small-20px.font 2009-02-25
20:00:08 UTC (rev 3965)
@@ -1,10 +1,12 @@
(pingus-font
- (image "images/fonts/pingus-small-20px.png")
- (size 20)
- (glyph-count 533)
- (char-spacing 1.6)
- (vertical-spacing 1.4)
- (glyphs
+ (size 20)
+ (glyph-count 533)
+ (char-spacing 1.6)
+ (vertical-spacing 1.4)
+ (images
+ (image
+ (filename "images/fonts/pingus-small-20px.png")
+ (glyphs
(glyph (unicode 506) (offset 0 -24) (advance 14) (rect 0 0 16 28))
(glyph (unicode 471) (offset 0 -25) (advance 10) (rect 16 0 28 28))
(glyph (unicode 475) (offset 0 -25) (advance 10) (rect 28 0 40 28))
@@ -540,7 +542,6 @@
(glyph (unicode 182) (offset 0 0) (advance 14) (rect 150 243 152 245))
(glyph (unicode 167) (offset 0 0) (advance 14) (rect 152 243 154 245))
(glyph (unicode 160) (offset 0 0) (advance 6) (rect 154 243 156 245))
- ))
+ ))))
;; EOF ;;
-
Modified: trunk/pingus/data/images/fonts/verdana11.font
===================================================================
--- trunk/pingus/data/images/fonts/verdana11.font 2009-02-25 19:42:46 UTC
(rev 3964)
+++ trunk/pingus/data/images/fonts/verdana11.font 2009-02-25 20:00:08 UTC
(rev 3965)
@@ -1,9 +1,11 @@
(pingus-font
- (image "images/fonts/verdana11.png")
- (size 11)
- (glyph-count 680)
- (char-spacing 0)
- (glyphs
+ (size 11)
+ (glyph-count 680)
+ (char-spacing 0)
+ (images
+ (image
+ (filename "images/fonts/verdana11.png")
+ (glyphs
(glyph (unicode 7862) (offset 0 -11) (advance 8) (rect 0 0 8 13))
(glyph (unicode 7852) (offset 0 -11) (advance 8) (rect 8 0 16 13))
(glyph (unicode 7878) (offset 1 -11) (advance 7) (rect 16 0 21 13))
@@ -687,6 +689,7 @@
(glyph (unicode 160) (offset 0 0) (advance 4) (rect 14 134 14 134))
(glyph (unicode 61453) (offset 0 0) (advance 0) (rect 14 134 14 134))
(glyph (unicode 32) (offset 0 0) (advance 4) (rect 14 134 14 134))
- ))
+ ))))
+
;; EOF ;;
Modified: trunk/pingus/src/font.cpp
===================================================================
--- trunk/pingus/src/font.cpp 2009-02-25 19:42:46 UTC (rev 3964)
+++ trunk/pingus/src/font.cpp 2009-02-25 20:00:08 UTC (rev 3965)
@@ -32,7 +32,7 @@
public:
FramebufferSurface framebuffer_surface;
typedef std::vector<GlyphDescription*> Glyphs;
- Glyphs glyphs; // FIXME: Use a hashmap or something else faster then a map
+ Glyphs glyphs;
int space_length;
float char_spacing;
float vertical_spacing;
@@ -42,11 +42,11 @@
: char_spacing(desc.char_spacing),
size(desc.size)
{
- framebuffer_surface =
Display::get_framebuffer().create_surface(Surface(desc.image));
+ framebuffer_surface =
Display::get_framebuffer().create_surface(Surface(desc.images[0].pathname));
if (!framebuffer_surface)
{
- std::cout << "IMG: " << desc.image.str() << std::endl;
+ std::cout << "IMG: " << desc.images[0].pathname.str() << std::endl;
assert(false);
}
@@ -55,7 +55,7 @@
glyphs.resize(65536); // 16bit ought to be enough for everybody
// Copyh Unicode -> Glyph mapping
- for(std::vector<GlyphDescription>::const_iterator i = desc.glyphs.begin();
i != desc.glyphs.end(); ++i)
+ for(std::vector<GlyphDescription>::const_iterator i =
desc.images[0].glyphs.begin(); i != desc.images[0].glyphs.end(); ++i)
{
if (i->unicode < glyphs.size())
glyphs[i->unicode] = new GlyphDescription(*i);
Modified: trunk/pingus/src/font_description.cpp
===================================================================
--- trunk/pingus/src/font_description.cpp 2009-02-25 19:42:46 UTC (rev
3964)
+++ trunk/pingus/src/font_description.cpp 2009-02-25 20:00:08 UTC (rev
3965)
@@ -49,18 +49,30 @@
}
else
{
- reader.read_path("image", image);
reader.read_float("char-spacing", char_spacing);
reader.read_float("vertical-spacing", vertical_spacing);
reader.read_int("size", size);
-
- FileReader glyph_section;
- if (reader.read_section("glyphs", glyph_section))
+
+ FileReader images_reader;
+ if (reader.read_section("images", images_reader))
{
- std::vector<FileReader> glyph_reader = glyph_section.get_sections();
- for(std::vector<FileReader>::iterator i = glyph_reader.begin(); i !=
glyph_reader.end(); ++i)
+ std::vector<FileReader> images_lst = images_reader.get_sections();
+
+ for(std::vector<FileReader>::iterator i = images_lst.begin(); i !=
images_lst.end(); ++i)
{
- glyphs.push_back(GlyphDescription(*i));
+ GlyphImageDescription image_desc;
+ i->read_path("filename", image_desc.pathname);
+
+ FileReader glyph_section;
+ if (i->read_section("glyphs", glyph_section))
+ {
+ std::vector<FileReader> glyph_reader =
glyph_section.get_sections();
+ for(std::vector<FileReader>::iterator i =
glyph_reader.begin(); i != glyph_reader.end(); ++i)
+ {
+ image_desc.glyphs.push_back(GlyphDescription(*i));
+ }
+ }
+ images.push_back(image_desc);
}
}
}
Modified: trunk/pingus/src/font_description.hpp
===================================================================
--- trunk/pingus/src/font_description.hpp 2009-02-25 19:42:46 UTC (rev
3964)
+++ trunk/pingus/src/font_description.hpp 2009-02-25 20:00:08 UTC (rev
3965)
@@ -36,13 +36,23 @@
GlyphDescription(FileReader& reader);
};
+class GlyphImageDescription
+{
+public:
+ /** Image file from which the basic surface is loaded */
+ Pathname pathname;
+
+ /** Characters in the font image */
+ std::vector<GlyphDescription> glyphs;
+};
+
/** */
class FontDescription
{
public:
Pathname pathname;
- /** Space between two characters */
+ /** Space between two characters, given in pixel */
float char_spacing;
/** Spacing between lines, given in multiples of \a size */
@@ -51,12 +61,8 @@
/** Vertical height of the font */
int size;
- /** Image file from which the basic surface is loaded */
- Pathname image;
+ std::vector<GlyphImageDescription> images;
- /** Characters in the font image */
- std::vector<GlyphDescription> glyphs;
-
FontDescription(const Pathname& filename);
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r3965 - in trunk/pingus: data/images/fonts src,
grumbel at BerliOS <=