Commit Graph

84 Commits

Author SHA1 Message Date
Eugene Sandulenko
abea37c9bb
ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Thierry Crozat
a3f3d71c57 GRAPHICS: Expose ascent value in font class 2021-03-23 20:25:23 +00:00
Paul Gilbert
4142f7b7f8 GRAPHICS: Allow TTFFont to handle ManagedSurfaces with transparent pixels 2021-02-26 17:58:19 -08:00
antoniou79
5e467e1bbc GRAPHICS: FONT: Clarification for combo of wrapping flags
for the wordWrapTextImpl and the kWordWrapEvenWidthLines, kWordWrapOnExplicitNewLines bit flags
2020-12-09 18:53:42 +02:00
Eugene Sandulenko
87beb98b95 GRAPHICS: Turn set of bool parameters for wordWrap() to a bitfield 2020-10-16 23:52:18 +02:00
aryanrawlani28
546fe374df GRAPHICS: Properly assign chars in handleEllipsis according to stringtype 2020-08-30 14:43:41 +02:00
aryanrawlani28
aa33fc2354 GRAPHICS: Use template for handleEllipsis 2020-08-30 14:43:41 +02:00
aryanrawlani28
ad78777bc6 GUI: Handle ellipsis shortening of text when drawing u32 strings 2020-08-30 14:43:41 +02:00
aryanrawlani28
51d95f8978 GRAPHICS: move start + end to Graphics::TextAlign 2020-06-22 00:03:02 +02:00
aryanrawlani28
5a093e4e95 GUI: RTL: Improve right align text drawing
- Fix last chars being eaten
- Add support for input in right-align mode editables
- Fix issue with dirtyness of editables after clicking
- Improve spacing for lists and popup
- Make numbers reversed in lists
2020-06-22 00:03:02 +02:00
Thanasis Antoniou
1bca3de594 COMMON: Support text wrapping with even width line segments
The new arguments are optional. The lines segments will be close to the same width.

The algorithm is similar to the one we had for Blade Runner but not exactly the same, since that one would wrap a line at a white space after the theoretical split point (quotient of full line text width divided by target lines number)
2019-08-02 00:08:38 +02:00
Paul Gilbert
e5b73b2899 GRAPHICS: Add deltax optional parameter to Font drawString U32String version 2018-11-14 19:00:17 -08:00
Bastien Bouclet
7362060c47 GRAPHICS: Improve check to test if text fits in the target surface
When rendering text, especially truetype fonts, we would use the next
character avance metric to check if the character fits in the target
surface. This commit changes it to use the bounding box metric. The
bounding box represents the actual pixels that will be touched when
drawing the character.

This fixes an issue noticed on the main menu of Myst ME where the last
character of the string "OPTIONEN" would not be rendered despite there
being enough room to render it. More precisely, this ensures that
calling Font::getBoundingBox for a string, and then passing a surface
exactly the size of the returned bounding box to the draw function
actually renders all the characters.
2018-08-03 22:35:16 +02:00
Ľubomír Remák
d9b3853dec COMMON: Fix kerning issue in wordWrapText. 2018-08-02 18:54:13 +02:00
Eugene Sandulenko
dc640ab50a GRAPHICS: Added optional initial line width ot text wrapper 2017-01-29 18:41:07 +01:00
stevenhoefel
feab260c98 GRAPHICS: Fix oversight on length value to return. 2017-01-17 22:14:58 +11:00
stevenhoefel
2e48529fa1 DIRECTOR: Utilise MacText class to provide Text Wrapping. 2017-01-15 18:42:50 +11:00
Torbjörn Andersson
bf851cc525 GRAPHICS: Handle Windows and Mac line breaks when word-wrapping text
This seems like the right place to do it. Hopefully it's also the
right way. It fixes line breaks in the MacVenture engine, where the
text apparently uses Mac line breaks.
2016-09-05 18:41:40 +02:00
Johannes Schickel
ce1be463c2 GRAPHICS: Implement convenience Font::drawChar taking ManagedSurface. 2016-03-21 02:03:12 +01:00
Johannes Schickel
2e5ef74848 GRAPHICS: Use correct bounding rect in Font::drawString taking Common::String. 2016-03-20 20:03:54 +01:00
Johannes Schickel
71c649f8d9 GRAPHICS: Mark actual dirty area as dirty in Font::drawString. 2016-03-20 19:59:55 +01:00
Paul Gilbert
433a2daa6a GRAPHICS: Added ManagedSurface and Screen classes 2016-03-14 20:56:14 -04:00
Johannes Schickel
d55cd8f3b4 GRAPHICS: Allow to query the bounding box of chars/strings drawn with Font API. 2014-09-03 22:55:48 +02:00
Johannes Schickel
53332e8066 GRAPHICS: Make GPL headers consistent in themselves. 2014-02-18 02:39:34 +01:00
Johannes Schickel
9da09f5846 GRAPHICS: Allow Font to accept U32String as strings. 2013-11-23 21:34:54 +01:00
Johannes Schickel
afa3f50b8a GRAPHICS: Let Font take uint32 as character codes.
This is required to support UTF-32 strings but does not make them work
automatically!
2013-11-23 21:34:54 +01:00
Narek Mailian
887a99e211 GRAPHICS: Added changes and improved code from inisider/scummvm (partial text)
Includes code from https://github.com/inisider/scummvm/ , which has been
squashed and bugfixed
2013-08-16 20:54:08 +02:00
Max Horn
4f8665fc83 COMMON: Move isFoo functions to namespace Common, add doxygen comments 2012-02-20 16:18:27 +01:00
Max Horn
658080deed ALL: Avoid using is* macros from ctype.h
On some systems, passing signed chars to macros like isspace() etc. lead
to a runtime error. Hence, mark these macros as forbidden by default,
and introduce otherwise equivalent alternatives for them.
2012-02-15 16:51:37 +01:00
Johannes Schickel
9f3fbe1bd7 GRAPHICS/GUI: Implement kerning support for Font.
This adapts the related graphics code, which is the generic Font API and the
TTF font implementation.

It furthermore adapts the GUI to properly take care of kerning in text input
widgets.
2012-01-29 16:26:20 +01:00
Johannes Schickel
8201df7bb6 GRAPHICS: Move NewFont code to a separate file. 2011-07-01 21:10:25 +02:00
Littleboy
b694a78f62 ANALYSIS: Add static casts to is* functions
This fixes a potential problem with passing char values that would be sign-extended and yield unexpected results.
See http://msdn.microsoft.com/en-us/library/ms245348.aspx
2011-06-23 08:52:52 -04:00
Julien
8a5bda72cc BACKENDS/GRAPHICS: Silence non zero-terminated terminated buffers warnings by initializing the buffers to 0 2011-06-23 15:11:37 +08:00
Max Horn
90d3fc9f5b GRAPHICS: Rename some members of NewFont 2011-05-23 12:13:02 +02:00
strangerke
69b1485a22 GIT: Clean up: Suppress SVN tags, now useless 2011-05-12 01:16:22 +02:00
Johannes Schickel
71bdb86e02 Merge pull request #16 "Add a PixelFormat to Graphics::Surface.".
For further discussion check here:
https://github.com/scummvm/scummvm/pull/16

Conflicts:
	graphics/png.cpp
2011-05-01 16:54:45 +02:00
Ori Avtalion
9414d7a6e2 JANITORIAL: Reduce header dependencies in shared code
Some backends may break as I only compiled SDL
2011-04-28 15:08:58 +03:00
Johannes Schickel
3fd919060c GRPAHICS: Do not access Surface::bytesPerPixel anymore. 2011-04-17 20:58:08 +02:00
Filippos Karapetis
cc0b2b210f GRAPHICS: Fixed code analysis warnings (bug #3087917)
svn-id: r54964
2010-12-19 16:16:25 +00:00
Johannes Schickel
c8aabe77e8 GUI: Fix font cache.
The bounding boxes of the glyphs use signed coordinates. We stored only
unsigned coordinates, which resulted in incorrect glyph positioning.

Conrecte example: the bounding box of the glyphs for clR6x12-iso-8859-5.bdf
used:

x y  w h
0 -3 6 12

We on the other hand interpreted that as:

x y     w h
0 65533 6 12

when loading the font from our font cache.

svn-id: r51586
2010-08-01 19:31:37 +00:00
Max Horn
c934642bdb COMMON: Move typedef StringList from str.h to new header str-array.h
This removes the dependency on array.h from str.h.
Also, begun migration from the confusing type name "StringList" to
the more appropriate StringArray.

svn-id: r48282
2010-03-18 15:09:24 +00:00
Max Horn
d083e02215 Rename Common::Stream::readLine_NEW to readLine
svn-id: r46779
2009-12-30 23:00:55 +00:00
Max Horn
6c98169dc3 GUI: Shorten button labels if too long, and improve the shortening logic
svn-id: r46381
2009-12-15 08:19:59 +00:00
Max Horn
6b98c4c4e7 Got rid of some more ioFailed uses (also fixed a potential leak in graphics/font.cpp, and handle eos correctly in the FLAC code)
svn-id: r42488
2009-07-14 18:24:20 +00:00
Johannes Schickel
96abaaea6d Fix possible memory leak.
svn-id: r42487
2009-07-14 18:15:07 +00:00
Johannes Schickel
3f1563c819 Got rid of ioFailed in font code, also added another check for err() when loading bdf fonts from text files.
svn-id: r42486
2009-07-14 18:14:20 +00:00
Max Horn
65b5d31814 COMMON: Removed Stream::ioFailed() and clearIOFailed(), as they are deprecated; however, retained ioFailed in SeekableReadStream and File for now (so for now this mainly affects WriteStream subclasses)
svn-id: r40725
2009-05-19 11:42:14 +00:00
Jordi Vilalta Prat
b1999a2a16 Fixed indentation and removed whitespaces at the end of line
svn-id: r35481
2008-12-22 11:22:15 +00:00
Max Horn
eb27307c12 minor tweaks
svn-id: r35036
2008-11-13 11:20:43 +00:00
Max Horn
3b01ed48f5 Further optimized drawCharIntern (on my system, 30% of the time used to draw the GUI is spent in there)
svn-id: r35028
2008-11-12 22:15:47 +00:00