ScummVM API documentation
Sci::GfxText32 Class Reference

#include <text32.h>

Public Member Functions

 GfxText32 (SegManager *segMan, GfxCache *fonts)
 
reg_t createFontBitmap (int16 width, int16 height, const Common::Rect &rect, const Common::String &text, const uint8 foreColor, const uint8 backColor, const uint8 skipColor, const GuiResourceId fontId, TextAlign alignment, const int16 borderColor, bool dimmed, const bool doScaling, const bool gc)
 
reg_t createFontBitmap (const CelInfo32 &celInfo, const Common::Rect &rect, const Common::String &text, const int16 foreColor, const int16 backColor, const GuiResourceId fontId, const int16 skipColor, const int16 borderColor, const bool dimmed, const bool gc)
 
reg_t createTitledFontBitmap (int16 width, int16 height, const Common::Rect &textRect, const Common::String &text, const uint8 foreColor, const uint8 backColor, const uint8 skipColor, const GuiResourceId fontId, const TextAlign alignment, const int16 borderColor, const Common::String &title, const uint8 titleForeColor, const uint8 titleBackColor, const GuiResourceId titleFontId, const bool doScaling, const bool gc)
 
int scaleUpWidth (int value) const
 
int scaleUpHeight (int value) const
 
void drawTextBox ()
 
void drawTextBox (const Common::String &text)
 
void erase (const Common::Rect &rect, const bool doScaling)
 
void invertRect (const reg_t bitmap, const int16 bitmapStride, const Common::Rect &rect, const uint8 foreColor, const uint8 backColor, const bool doScaling)
 
void setFont (const GuiResourceId fontId)
 
int16 getScaledFontHeight () const
 
uint16 getCharWidth (const uint16 charIndex, const bool doScaling) const
 
Common::Rect getTextSize (const Common::String &text, const int16 maxWidth, bool doScaling)
 
int16 getTextWidth (const Common::String &text, const uint index, const uint length)
 
int16 getStringWidth (const Common::String &text)
 
int16 getTextCount (const Common::String &text, const uint index, const Common::Rect &textRect, const bool doScaling)
 
int16 getTextCount (const Common::String &text, const uint index, const GuiResourceId fontId, const Common::Rect &textRect, const bool doScaling)
 
void scrollLine (const Common::String &textLine, int numLines, uint8 color, TextAlign align, GuiResourceId fontId, ScrollDirection dir)
 
bool SwitchToFont1001OnKorean (const char *text)
 

Static Public Member Functions

static void init ()
 

Public Attributes

reg_t _bitmap
 
GfxFont_font
 

Static Public Attributes

static int16 _xResolution
 
static int16 _yResolution
 

Detailed Description

This class handles text calculation and rendering for SCI32 games. The text calculation system in SCI32 is nearly the same as SCI16, which means this class behaves similarly. Notably, GfxText32 maintains drawing parameters across multiple calls, instead of requiring all text parameters to be provided on every draw call.

Member Function Documentation

◆ init()

static void Sci::GfxText32::init ( )
static

Initialises static GfxText32 members.

◆ createFontBitmap() [1/2]

reg_t Sci::GfxText32::createFontBitmap ( int16  width,
int16  height,
const Common::Rect rect,
const Common::String text,
const uint8  foreColor,
const uint8  backColor,
const uint8  skipColor,
const GuiResourceId  fontId,
TextAlign  alignment,
const int16  borderColor,
bool  dimmed,
const bool  doScaling,
const bool  gc 
)

Creates a plain font bitmap with a flat color background.

◆ createFontBitmap() [2/2]

reg_t Sci::GfxText32::createFontBitmap ( const CelInfo32 celInfo,
const Common::Rect rect,
const Common::String text,
const int16  foreColor,
const int16  backColor,
const GuiResourceId  fontId,
const int16  skipColor,
const int16  borderColor,
const bool  dimmed,
const bool  gc 
)

Creates a font bitmap with a view background.

◆ createTitledFontBitmap()

reg_t Sci::GfxText32::createTitledFontBitmap ( int16  width,
int16  height,
const Common::Rect textRect,
const Common::String text,
const uint8  foreColor,
const uint8  backColor,
const uint8  skipColor,
const GuiResourceId  fontId,
const TextAlign  alignment,
const int16  borderColor,
const Common::String title,
const uint8  titleForeColor,
const uint8  titleBackColor,
const GuiResourceId  titleFontId,
const bool  doScaling,
const bool  gc 
)

Creates a titled font bitmap with a flat color background.

◆ drawTextBox() [1/2]

void Sci::GfxText32::drawTextBox ( )

Draws the text to the bitmap.

◆ drawTextBox() [2/2]

void Sci::GfxText32::drawTextBox ( const Common::String text)

Draws the given text to the bitmap.

Note
SSCI holds a reference to a shared string which lets the text be updated from outside of the font manager. Instead, we use this extra signature to send the text to draw.

◆ erase()

void Sci::GfxText32::erase ( const Common::Rect rect,
const bool  doScaling 
)

Erases the given rect by filling with the background color.

◆ setFont()

void Sci::GfxText32::setFont ( const GuiResourceId  fontId)

Sets the font to be used for rendering and calculation of text dimensions.

◆ getScaledFontHeight()

int16 Sci::GfxText32::getScaledFontHeight ( ) const

Gets the pixel height of the currently loaded font.

◆ getCharWidth()

uint16 Sci::GfxText32::getCharWidth ( const uint16  charIndex,
const bool  doScaling 
) const

Gets the width of a character.

◆ getTextSize()

Common::Rect Sci::GfxText32::getTextSize ( const Common::String text,
const int16  maxWidth,
bool  doScaling 
)

Retrieves the width and height of a block of text.

◆ getTextWidth()

int16 Sci::GfxText32::getTextWidth ( const Common::String text,
const uint  index,
const uint  length 
)

Gets the pixel width of a substring of the currently loaded text, with scaling.

◆ getStringWidth()

int16 Sci::GfxText32::getStringWidth ( const Common::String text)

Retrieves the width of a line of text.

◆ getTextCount() [1/2]

int16 Sci::GfxText32::getTextCount ( const Common::String text,
const uint  index,
const Common::Rect textRect,
const bool  doScaling 
)

Gets the number of characters of text, starting from index, that can be safely rendered into textRect.

◆ getTextCount() [2/2]

int16 Sci::GfxText32::getTextCount ( const Common::String text,
const uint  index,
const GuiResourceId  fontId,
const Common::Rect textRect,
const bool  doScaling 
)

Gets the number of characters of text, starting from index, that can be safely rendered into textRect using the given font.

◆ scrollLine()

void Sci::GfxText32::scrollLine ( const Common::String textLine,
int  numLines,
uint8  color,
TextAlign  align,
GuiResourceId  fontId,
ScrollDirection  dir 
)

Scroll up/down one line. numLines is the number of the lines in the textarea, and textLine contains the text to draw as the newly visible line. Originally FontMgr::DrawOneLine and FontMgr::UpOneLine.

Member Data Documentation

◆ _bitmap

reg_t Sci::GfxText32::_bitmap

The memory handle of the currently active bitmap.

◆ _xResolution

int16 Sci::GfxText32::_xResolution
static

The size of the x-dimension of the coordinate system used by the text renderer. Static since it was global in SSCI.

◆ _yResolution

int16 Sci::GfxText32::_yResolution
static

The size of the y-dimension of the coordinate system used by the text renderer. Static since it was global in SSCI.

◆ _font

GfxFont* Sci::GfxText32::_font

The currently active font resource used to write text into the bitmap.

Note
SSCI builds the font table directly inside of FontMgr; we use GfxFont instead.

The documentation for this class was generated from the following file: