pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] r2801 - in branches/pingus_sdl: data/images/fonts src


From: grumbel at BerliOS
Subject: [Pingus-CVS] r2801 - in branches/pingus_sdl: data/images/fonts src
Date: Sat, 4 Aug 2007 22:19:24 +0200

Author: grumbel
Date: 2007-08-04 22:19:23 +0200 (Sat, 04 Aug 2007)
New Revision: 2801

Added:
   branches/pingus_sdl/data/images/fonts/reference-iso-8859-1.font
   branches/pingus_sdl/data/images/fonts/reference-iso-8859-1.png
Modified:
   branches/pingus_sdl/data/images/fonts/chalk_large-iso-8859-1.font
   branches/pingus_sdl/data/images/fonts/chalk_normal-iso-8859-1.font
   branches/pingus_sdl/data/images/fonts/chalk_small-iso-8859-1.font
   branches/pingus_sdl/data/images/fonts/pingus-iso-8859-1.font
   branches/pingus_sdl/data/images/fonts/pingus_small-iso-8859-1.font
   branches/pingus_sdl/data/images/fonts/pingus_small_fix_num-iso-8859-1.font
   branches/pingus_sdl/src/font.cpp
   branches/pingus_sdl/src/font_test_screen.cpp
   branches/pingus_sdl/src/font_test_screen.hpp
   branches/pingus_sdl/src/fonts.cpp
Log:
- all fonts fixed
- new reference font

Modified: branches/pingus_sdl/data/images/fonts/chalk_large-iso-8859-1.font
===================================================================
--- branches/pingus_sdl/data/images/fonts/chalk_large-iso-8859-1.font   
2007-08-04 19:45:22 UTC (rev 2800)
+++ branches/pingus_sdl/data/images/fonts/chalk_large-iso-8859-1.font   
2007-08-04 20:19:23 UTC (rev 2801)
@@ -5,7 +5,7 @@
  (alpha-threshold  0)
  (characters "!\"#$%&'()*+,-./0123456789:;<=>?@"
              "ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
-             
"���������������������������������������������������������������������������������������������")
+             
"�����������������������������������������������������������������������������������������������")
  (image "data/images/fonts/chalk_large-iso-8859-1.png"))
 
 ;; EOF ;;

Modified: branches/pingus_sdl/data/images/fonts/chalk_normal-iso-8859-1.font
===================================================================
--- branches/pingus_sdl/data/images/fonts/chalk_normal-iso-8859-1.font  
2007-08-04 19:45:22 UTC (rev 2800)
+++ branches/pingus_sdl/data/images/fonts/chalk_normal-iso-8859-1.font  
2007-08-04 20:19:23 UTC (rev 2801)
@@ -5,7 +5,7 @@
  (alpha-threshold  0)
  (characters "!\"#$%&'()*+,-./0123456789:;<=>?@"
              "ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
-             
"���������������������������������������������������������������������������������������������")
+             
"�����������������������������������������������������������������������������������������������")
  (image "data/images/fonts/chalk_normal-iso-8859-1.png"))
 
 ;; EOF ;;

Modified: branches/pingus_sdl/data/images/fonts/chalk_small-iso-8859-1.font
===================================================================
--- branches/pingus_sdl/data/images/fonts/chalk_small-iso-8859-1.font   
2007-08-04 19:45:22 UTC (rev 2800)
+++ branches/pingus_sdl/data/images/fonts/chalk_small-iso-8859-1.font   
2007-08-04 20:19:23 UTC (rev 2801)
@@ -5,7 +5,7 @@
  (alpha-threshold  0)
  (characters "!\"#$%&'()*+,-./0123456789:;<=>?@"
              "ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
-             
"���������������������������������������������������������������������������������������������")
+             
"�����������������������������������������������������������������������������������������������")
  (image "data/images/fonts/chalk_small-iso-8859-1.png"))
 
 ;; EOF ;;

Modified: branches/pingus_sdl/data/images/fonts/pingus-iso-8859-1.font
===================================================================
--- branches/pingus_sdl/data/images/fonts/pingus-iso-8859-1.font        
2007-08-04 19:45:22 UTC (rev 2800)
+++ branches/pingus_sdl/data/images/fonts/pingus-iso-8859-1.font        
2007-08-04 20:19:23 UTC (rev 2801)
@@ -5,7 +5,7 @@
  (alpha-threshold  0)
  (characters "!\"#$%&'()*+,-./0123456789:;<=>?@"
              "ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
-             
"���������������������������������������������������������������������������������������������")
+             
"�����������������������������������������������������������������������������������������������")
  (image "data/images/fonts/pingus-iso-8859-1.png"))
 
 ;; EOF ;;

Modified: branches/pingus_sdl/data/images/fonts/pingus_small-iso-8859-1.font
===================================================================
--- branches/pingus_sdl/data/images/fonts/pingus_small-iso-8859-1.font  
2007-08-04 19:45:22 UTC (rev 2800)
+++ branches/pingus_sdl/data/images/fonts/pingus_small-iso-8859-1.font  
2007-08-04 20:19:23 UTC (rev 2801)
@@ -5,7 +5,7 @@
  (alpha-threshold  0)
  (characters "!\"#$%&'()*+,-./0123456789:;<=>?@"
              "ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
-             
"���������������������������������������������������������������������������������������������")
+             
"�����������������������������������������������������������������������������������������������")
  (image "data/images/fonts/pingus_small-iso-8859-1.png"))
 
 ;; EOF ;;

Modified: 
branches/pingus_sdl/data/images/fonts/pingus_small_fix_num-iso-8859-1.font
===================================================================
--- branches/pingus_sdl/data/images/fonts/pingus_small_fix_num-iso-8859-1.font  
2007-08-04 19:45:22 UTC (rev 2800)
+++ branches/pingus_sdl/data/images/fonts/pingus_small_fix_num-iso-8859-1.font  
2007-08-04 20:19:23 UTC (rev 2801)
@@ -5,7 +5,7 @@
  (alpha-threshold  0)
  (characters "!\"#$%&'()*+,-./0123456789:;<=>?@"
              "ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
-             
"���������������������������������������������������������������������������������������������")
+             
"�����������������������������������������������������������������������������������������������")
  (image "data/images/fonts/pingus_small-iso-8859-1.png"))
 
 ;; EOF ;;

Added: branches/pingus_sdl/data/images/fonts/reference-iso-8859-1.font
===================================================================
--- branches/pingus_sdl/data/images/fonts/reference-iso-8859-1.font     
2007-08-04 19:45:22 UTC (rev 2800)
+++ branches/pingus_sdl/data/images/fonts/reference-iso-8859-1.font     
2007-08-04 20:19:23 UTC (rev 2801)
@@ -0,0 +1,11 @@
+;; -*- scheme -*-
+(pingus-font
+ (name "Verdana9 with Border")
+ (space-length     8)
+ (alpha-threshold  0)
+ (characters "!\"#$%&'()*+,-./0123456789:;<=>?@"
+             "ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
+             
"�����������������������������������������������������������������������������������������������")
+ (image "data/images/fonts/reference-iso-8859-1.png"))
+
+;; EOF ;;

Added: branches/pingus_sdl/data/images/fonts/reference-iso-8859-1.png
===================================================================
(Binary files differ)


Property changes on: 
branches/pingus_sdl/data/images/fonts/reference-iso-8859-1.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Modified: branches/pingus_sdl/src/font.cpp
===================================================================
--- branches/pingus_sdl/src/font.cpp    2007-08-04 19:45:22 UTC (rev 2800)
+++ branches/pingus_sdl/src/font.cpp    2007-08-04 20:19:23 UTC (rev 2801)
@@ -32,6 +32,9 @@
 
 static bool vline_empty(SDL_Surface* surface, int x, Uint8 threshold)
 {
+  if (x >= surface->w)
+    return true;
+
   Uint8* pixels = (Uint8*)surface->pixels;
 
   for(int y = 0; y < surface->h; ++y)
@@ -77,7 +80,9 @@
     
     int first = -1; // -1 signals no character start found yet
     int idx = 0;
-    for(int x = 0; x < surface->w; ++x)
+    for(int x = 0; x <= surface->w; ++x) // '<=' so we scan one past
+                                         // the last line, to catch
+                                         // the last character
       {
         if (!vline_empty(surface, x, desc.alpha_threshold))
           { // line contains a character
@@ -120,7 +125,7 @@
     if (idx != int(desc.characters.size())) 
       {
         std::cout << "Font: " << desc.image << "\n"
-                  << "  Error: " << idx << " expected "  << 
desc.characters.size() << "\n"
+                  << "  Error: glyphs found: " << idx << ", expected "  << 
desc.characters.size() << "\n"
                   << "  Format: bpp: " << int(surface->format->BitsPerPixel) 
<< "\n"
                   << "  Size: " << surface->w << "x" << surface->h
           //      << "  RMask: " << hex << surface->format->Rmask << "\n"

Modified: branches/pingus_sdl/src/font_test_screen.cpp
===================================================================
--- branches/pingus_sdl/src/font_test_screen.cpp        2007-08-04 19:45:22 UTC 
(rev 2800)
+++ branches/pingus_sdl/src/font_test_screen.cpp        2007-08-04 20:19:23 UTC 
(rev 2801)
@@ -24,6 +24,7 @@
 */
 
 #include "fonts.hpp"
+#include "string_util.hpp"
 #include "display/drawing_context.hpp"
 #include "font_description.hpp"
 #include "font_test_screen.hpp"
@@ -34,6 +35,7 @@
 {
   std::cout << "### Loading font file: " << fontfile << std::endl;
   font = Font(FontDescription(fontfile));
+  reference = Font(FontDescription("images/fonts/reference-iso-8859-1.font"));
 }
 
 bool
@@ -46,7 +48,7 @@
         if ((x+y) % 2 != 0)
           gc.draw_fillrect(x*checker, y*checker,
                            x*checker + checker, y*checker + checker,
-                           Color(100, 100, 100));
+                           Color(50, 50, 50));
         else
           gc.draw_fillrect(x*checker, y*checker,
                            x*checker + checker, y*checker + checker,
@@ -60,12 +62,25 @@
 
   for(int i = 0; i < 256; ++i)
     {
-      float x = 64.f + (i%20)*(font.get_height() + 4);
-      float y = 64.f + (i/20)*(font.get_height() + 6);
+      float x = 64.0f + (i%20)*(font.get_height() + 12);
+      float y = 64.0f + (i/20)*(font.get_height() + 12);
 
+      gc.print_right(reference,
+                    x + font.get_height(), y,
+                    std::string(1, char(i)));
+
+      gc.print_right(reference,
+                    x + font.get_height(), 
+                     y + font.get_height() - reference.get_height(),
+                     StringUtil::to_string(i));
+      
       if (font.get_width(char(i)))
         {
           gc.draw_rect(x, y, 
+                       x+font.get_height(), 
+                       y+font.get_height(), 
+                       Color(0,0,255));
+          gc.draw_rect(x, y, 
                        x+font.get_width(char(i)), 
                        y+font.get_height(), 
                        Color(255,0,255));

Modified: branches/pingus_sdl/src/font_test_screen.hpp
===================================================================
--- branches/pingus_sdl/src/font_test_screen.hpp        2007-08-04 19:45:22 UTC 
(rev 2800)
+++ branches/pingus_sdl/src/font_test_screen.hpp        2007-08-04 20:19:23 UTC 
(rev 2801)
@@ -34,6 +34,7 @@
 {
 private:
   Font font;
+  Font reference;
   float scrollx;
   float scrolly;
 

Modified: branches/pingus_sdl/src/fonts.cpp
===================================================================
--- branches/pingus_sdl/src/fonts.cpp   2007-08-04 19:45:22 UTC (rev 2800)
+++ branches/pingus_sdl/src/fonts.cpp   2007-08-04 20:19:23 UTC (rev 2801)
@@ -53,7 +53,7 @@
 
   courier_small = Resource::load_font("fonts/courier_small" + std::string("-") 
+ encoding);
   xterm        = Resource::load_font("fonts/courier_small" + std::string("-") 
+ encoding);
-  smallfont    = Resource::load_font("fonts/courier_small" + std::string("-") 
+ encoding); //PingusResource::load_font("Fonts/smallfont","fonts");
+  smallfont    = Resource::load_font("fonts/pingus_small" + std::string("-") + 
encoding); //PingusResource::load_font("Fonts/smallfont","fonts");
   smallfont_h  = Resource::load_font("fonts/courier_small" + std::string("-") 
+ encoding); // PingusResource::load_font("Fonts/smallfont_h","fonts");
 
   lcd          = Resource::load_font("fonts/number_fnt");





reply via email to

[Prev in Thread] Current Thread [Next in Thread]