170 Commits

Author SHA1 Message Date
Philippe Plantier
a04b672ba6 Fixed the help crashing the game in font::word_wrap_text 2005-04-03 17:41:25 +00:00
Philippe Plantier
22d1f9aebf Made dialog text have a maximal height as well as a maximal width.
Made dialog text use word_wrap_text instead of text_to_lines to wrap text.
Rewrote word_wrap_text to support the notion of maximal height.
2005-04-02 14:06:35 +00:00
Guillaume Melquiond
d501297a65 Switch to the new logging macro. 2005-03-26 17:10:32 +00:00
Guillaume Melquiond
73feb6911e Remove illegal read for empty strings.
Sanitize utf8 iterators (const members, no empty constructor).
2005-03-26 15:32:26 +00:00
Guillaume Melquiond
d21e4149d6 Now the preprocessor output is also a stream, and so is the parser input, ...
...hence they can be plugged, yay. Also introduce a scoped_istream to
prevent leaking descriptors in case of exceptions. Once again, the
stream changes are purely on the interface level for the time being,
so there can be a slight performance hit when no cache is present. But
once the cache is built, everything should be fine, even faster than
it was before the changes. And isn't that the point of a cache?
2005-03-25 18:19:20 +00:00
Yann Dirson
d7d7ab8054 moved the overlay-related part of CVideo::flip() up to display;
this causes intro and about to require again a display, but that does
not harm much compared to this cleanup in video deps
2005-03-24 21:35:52 +00:00
Yann Dirson
8f311d9d87 text_to_lines() does not belong to show_dialog
- being more closely related to text, moved it to font
2005-03-23 20:46:58 +00:00
Philippe Plantier
183e200ef8 Const-correctness on play_level, and play_turn. 2005-03-19 10:26:43 +00:00
Philippe Plantier
ad0e5691b1 Adding support for japanese in language.cpp,
...and the support for the sazanami-gothic.ttf font. Fixed SDL_ttf so
it works with this font. Not adding the font itself (it is about
7Mb!). Testers should add it manually in the font/ directory.
2005-03-15 22:13:34 +00:00
Yann Dirson
a5a9f8205d cleanup of deps against display: fonts do not need a display at all 2005-03-15 20:01:31 +00:00
Yann Dirson
59ad858b54 include cleanup: tooltips 2005-03-10 22:29:57 +00:00
Yann Dirson
50e405a352 include cleanup: font 2005-03-09 23:30:28 +00:00
Yann Dirson
ed6810894b include cleanup: gettext, language 2005-03-09 22:58:18 +00:00
Dave White
9a29c25197 fixed compile error on vc++ 2005-03-08 02:16:32 +00:00
Guillaume Melquiond
567edd9eef Split text and binary parsers from config. 2005-03-05 10:54:25 +00:00
Jon Daniel
9f7260514d [[More fixing of text/surface machinery]]
* Added the complete utf8_string to text_surface again

* split only if necessary e.g. on the first call to width or height

* update set_text to set w_ and h_ to -1

* text_cache works again at least I get alot of hits in the campaign
  selection dialog if scrolling up and down
2005-03-04 20:23:40 +00:00
Jon Daniel
d5fce8801d updated measure_ucs2_text_line 2005-03-04 16:52:07 +00:00
Jon Daniel
99e81e10b3 * added text_chunk::operator!= 2005-03-04 12:34:37 +00:00
Jon Daniel
f368485a2c [[Text chunk and UTF-8 fixes]]
* Added operator== for text_chunk

* updated text_surface to store text_chunks instead of the str

* updated text_surface to render and measure ucs2_strings instead
  of UTF-8

* moved the split to the constructor and set_text

* added string parameter to hash because we don't store the string anymore
2005-03-04 11:59:54 +00:00
Jon Daniel
22d054a5ec [[UTF-8 and UCS2 fixes]]
* changed text_chunk to store utf8 and ucs2 versions of the text

* cleaned up split text and updated it to fill ucs2 values too

* minor changes to measure_ucs2_text_line
2005-03-04 05:49:04 +00:00
Jon Daniel
4daf9b75c6 Added measure_ucs2_text_line function...
...which retrieves the pixel width annd height of the range [first,
last) in a specific font size and style.
2005-03-04 04:26:15 +00:00
Philippe Plantier
1949375acf Replaced split_utf8_string by a new "utf8_iterator" class
Moved all utf8 encoding / decoding-related code to
serialization/string_utils.hpp
2005-03-03 21:52:40 +00:00
Jon Daniel
2b8733964c [[UTF-8 handling fixes]]
* Changed the text_chunk to contain a UTF-8 string instead of a UCS4
  string

* Updated split text to convert UTF-8 to UCS4 to look up the subset id
  and add UTF-8 strings to the text_chunk in the same loop.

* Changed some text_surface inspectors to be public.

* Changed text_surface::measure to use TTF_SizeUTF8

* Changed text_surface::get_surfaces to use TTF_RenderUTF8_Blended

* Changed text_surface::equal to text_surface::equals and let it use
  operator==(const SDL_Color&, const SDL_Color&)

* Moved byte_size_from_utf8_first out of the anonymous namespace and
  added a prototype in language hpp.

* Moved the invalid_utf8_exception to language.hpp

I think all the character encoding string conversion functions should
be moved to serialization/string_utils.
2005-03-02 14:18:38 +00:00
Philippe Plantier
8a5733130e Removed a compiler warning. 2005-03-01 21:12:42 +00:00
Dave White
920f5b467d change to network code to make receives threaded;
changes to make the game compile on VC++
2005-02-26 22:16:34 +00:00
Philippe Plantier
ecc140b0c2 Adding "return.cpp" in at the end of the font loading routine. 2005-02-26 22:12:08 +00:00
Philippe Plantier
a2c635d81e Fixed the fonts and i18n not working properly in the editor. 2005-02-26 18:52:24 +00:00
Philippe Plantier
16fecddb97 [[Translation housekeeping and a bug fix]]
* Added the ability for texts to be displayed in multiple fonts, depending on
characters.

* Fixed a few strings missing from translations

* Update pot and po files

* Fixed a bug, occuring when scrollbars are too small to contain the buttons
and the grip, resulting in huge scrollbars.
2005-02-26 18:10:02 +00:00
Guillaume Melquiond
a556922040 Fix bug with garbled strings (#12083).
The alpha setting of the surface was messed, let's always force it
(not sure about SDL_RLEACCEL though). I can't explain why it resulted
in this garbled display, and more importantly why it only happened
recently; so there may still be another problem lurking somewhere.
2005-02-22 10:17:06 +00:00
Guillaume Melquiond
fa1f3f6444 Remove the template code from animated.hpp and put it into animated.cpp.
This code was indirectly included in at least 25 files: the 25 files
for which a dependency on string_utils.hpp has been added by a
consequence of its removal from animated.hpp. It should induce a small
compile time improvement.
2005-02-21 09:05:51 +00:00
Guillaume Melquiond
2ab05941b5 Completely remove string functions from config.cpp. 2005-02-20 21:45:22 +00:00
Yann Dirson
81ffd3dc99 use fixed-point computations...
...so owners of FPU-less machines can still enjoy the game
2005-02-09 23:32:01 +00:00
Guillaume Melquiond
0c4aafb1f0 Don't load the whole font in memory when we only want to assert its existence.
Leak memory only when successful, not on error.
2005-01-08 21:49:29 +00:00
Yann Dirson
dda0ad8b54 fixed and activated reading fonts from zip files (thanks silene again) 2005-01-08 21:09:16 +00:00
Yann Dirson
db04ce7d49 (commented out) support for reading fonts from zip files 2005-01-08 13:59:05 +00:00
Yann Dirson
62d192562c moved basic file I/O from config.cpp to filesystem.cpp 2004-12-30 19:32:35 +00:00
Guillaume Melquiond
d7b3e389b7 Remove unused parameters and enum from font.cpp. 2004-11-27 10:24:50 +00:00
Dave White
c661b3043a reduced warnings to 0 on VC++ 2004-11-18 04:08:33 +00:00
Philippe Plantier
41649ea6a5 Fixed the "damage" flying numbers not fading away anymore. 2004-10-30 16:40:02 +00:00
Philippe Plantier
d55feb8585 Added shadows under labels,
so they can be visible on each type of terrain, light or dark.
2004-10-30 13:18:04 +00:00
Philippe Plantier
61dec4a02e Enabled back italics and underline now that the sdl_ttf is in the tree.
If this still causes memory corruption, sdl_ttf should be fixed, and not
font.cpp . (and then, patches should be posted to the SDL team, of course).
2004-10-30 11:50:30 +00:00
Philippe Plantier
b2900a6260 Added a CVS snapshot of SDL_ttf in the wesnoth tree
Made wesnoth link statically to those SDL_ttf files
Added checking for libfreetype in the autotools scripts.

Warning: changes made to the autotools script! they work for me, but
need testing and reviewing!

The main reason for that is that SDL_ttf 2.0.6 still has fatal
memory-corruption bugs, fixed in CVS. This fix looks like to prevent manu
segfaults for some configurations using the French translation.

This fix may be reverted when SDL_ttf 2.0.7 is released (or not).
2004-10-26 19:03:55 +00:00
Guillaume Melquiond
27af651cca Switched font rendering to the new logging system 2004-09-18 21:24:59 +00:00
Guillaume Melquiond
975f6a9e92 Don't say the font has opened okay when it has obviously not,
and remove wrapping debug.
2004-09-10 17:41:32 +00:00
Guillaume Melquiond
1626b9db93 Text rendering optimization, see patch 3334 for comments 2004-09-03 07:18:48 +00:00
Yann Dirson
37d0073136 drop the font from english.cfg,
...fill it directly from font.cpp.  also drop useless strings
2004-08-29 14:58:40 +00:00
Jordà Polo
03ee3f6676 title changes
* size: 18px

 * color: #BCB088
2004-08-26 20:56:03 +00:00
Dave White
0172e51f45 removed some unnecessary diagnostics (CVS internal) 2004-08-25 02:59:51 +00:00
Kristoffer Erlandsson
b851507b62 Made the tables in the unit help dynamic in size.
Should decrease the weirdness occuring on lower resolutions.
2004-08-16 14:17:19 +00:00
Philippe Plantier
4d8664be25 Workaround a SDL_TTF bug that makes it crash...
...when presented an invalid UTF-8 string.
2004-08-05 20:42:11 +00:00