[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r2985 - in branches/pingus_sdl: data/images/fonts src
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r2985 - in branches/pingus_sdl: data/images/fonts src |
Date: |
Fri, 17 Aug 2007 17:54:26 +0200 |
Author: grumbel
Date: 2007-08-17 17:54:25 +0200 (Fri, 17 Aug 2007)
New Revision: 2985
Modified:
branches/pingus_sdl/data/images/fonts/pingus_small-iso-8859-2.font
branches/pingus_sdl/data/images/fonts/pingus_small-iso-8859-9.font
branches/pingus_sdl/src/font.cpp
branches/pingus_sdl/src/font_description.cpp
branches/pingus_sdl/src/font_description.hpp
Log:
- changed horz/vert spacing to float to allow more finetunig
Modified: branches/pingus_sdl/data/images/fonts/pingus_small-iso-8859-2.font
===================================================================
--- branches/pingus_sdl/data/images/fonts/pingus_small-iso-8859-2.font
2007-08-17 15:39:18 UTC (rev 2984)
+++ branches/pingus_sdl/data/images/fonts/pingus_small-iso-8859-2.font
2007-08-17 15:54:25 UTC (rev 2985)
@@ -2,6 +2,7 @@
(pingus-font
(name "Pingus Small")
(space-length 8)
+ (char-spacing 0.6)
(alpha-threshold 0)
(characters "!\"#$%&'()*+,-./0123456789:;<=>?@"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
Modified: branches/pingus_sdl/data/images/fonts/pingus_small-iso-8859-9.font
===================================================================
--- branches/pingus_sdl/data/images/fonts/pingus_small-iso-8859-9.font
2007-08-17 15:39:18 UTC (rev 2984)
+++ branches/pingus_sdl/data/images/fonts/pingus_small-iso-8859-9.font
2007-08-17 15:54:25 UTC (rev 2985)
@@ -2,6 +2,7 @@
(pingus-font
(name "Pingus Small")
(space-length 8)
+ (char-spacing 0.6)
(alpha-threshold 0)
(characters "!\"#$%&'()*+,-./0123456789:;<=>?@"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
Modified: branches/pingus_sdl/src/font.cpp
===================================================================
--- branches/pingus_sdl/src/font.cpp 2007-08-17 15:39:18 UTC (rev 2984)
+++ branches/pingus_sdl/src/font.cpp 2007-08-17 15:54:25 UTC (rev 2985)
@@ -50,8 +50,8 @@
SDL_Surface* surface;
SDL_Rect chrs[256];
int space_length;
- int char_spacing;
- int vertical_spacing;
+ float char_spacing;
+ float vertical_spacing;
FontImpl(const FontDescription& desc)
: surface(0),
@@ -164,12 +164,13 @@
SDL_FreeSurface(surface);
}
- void draw(Origin origin, int x, int y, const std::string& text, SDL_Surface*
target)
+ void draw(Origin origin, int x, int y_, const std::string& text,
SDL_Surface* target)
{
+ float y = y_;
// FIXME: only origins top_left, top_right and top_center to work right now
LineIterator it(text);
while(it.next()) {
- draw_line(origin, x, y, it.get(), target);
+ draw_line(origin, x, int(y), it.get(), target);
y += vertical_spacing;
}
}
@@ -178,8 +179,8 @@
{
Vector2i offset = calc_origin(origin, get_size(text));
- int dstx = x - offset.x;
- int dsty = y - offset.y;
+ float dstx = x - offset.x;
+ float dsty = y - offset.y;
if (!target) target = Display::get_screen();
@@ -194,7 +195,7 @@
SDL_Rect& srcrect = chrs[static_cast<unsigned char>(text[i])];
if (srcrect.w != 0 && srcrect.h != 0)
{
- SDL_Rect dstrect = { dstx, dsty, 0, 0 };
+ SDL_Rect dstrect = { int(dstx), int(dsty), 0, 0 };
SDL_BlitSurface(surface, &srcrect, target, &dstrect);
dstx += srcrect.w + char_spacing;
}
Modified: branches/pingus_sdl/src/font_description.cpp
===================================================================
--- branches/pingus_sdl/src/font_description.cpp 2007-08-17 15:39:18 UTC
(rev 2984)
+++ branches/pingus_sdl/src/font_description.cpp 2007-08-17 15:54:25 UTC
(rev 2985)
@@ -28,8 +28,8 @@
monospace = false;
space_length = 20;
alpha_threshold = 0;
- char_spacing = 1;
- vertical_spacing = -1;
+ char_spacing = 1.0f;
+ vertical_spacing = -1.0f;
FileReader reader = FileReader::parse(filename);
@@ -43,8 +43,8 @@
reader.read_string("image", image);
reader.read_string("characters", characters);
reader.read_bool("monospace", monospace);
- reader.read_int("char-spacing", char_spacing);
- reader.read_int("vertical-spacing", vertical_spacing);
+ reader.read_float("char-spacing", char_spacing);
+ reader.read_float("vertical-spacing", vertical_spacing);
reader.read_int("space-length", space_length);
reader.read_int("alpha-threshold", alpha_threshold);
}
Modified: branches/pingus_sdl/src/font_description.hpp
===================================================================
--- branches/pingus_sdl/src/font_description.hpp 2007-08-17 15:39:18 UTC
(rev 2984)
+++ branches/pingus_sdl/src/font_description.hpp 2007-08-17 15:54:25 UTC
(rev 2985)
@@ -38,9 +38,9 @@
int space_length;
/** Space between two characters */
- int char_spacing;
+ float char_spacing;
- int vertical_spacing;
+ float vertical_spacing;
/** Minimum amount of alpha that is handled as character seperator */
int alpha_threshold;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r2985 - in branches/pingus_sdl: data/images/fonts src,
grumbel at BerliOS <=