new UTF8 drawing routines (yay!)

This commit is contained in:
pinkerton%netscape.com 1998-08-25 00:04:34 +00:00
Родитель defaa3615a
Коммит cfeb74516b
2 изменённых файлов: 85 добавлений и 3 удалений

Просмотреть файл

@ -30,6 +30,9 @@
#include "mfinder.h" // needed for workaround function to bug in Appe's
// ::TruncText and ::TruncString - andrewb 6/20/97
#include "UPropFontSwitcher.h"
#include "UUTF8TextHandler.h"
#ifndef __PALETTES__
#include <Palettes.h>
@ -1053,6 +1056,67 @@ void UGraphicGizmos::PlaceTextInRect(
::DrawText(text, 0, length);
}
//----------------------------------------------------------------------------------------
void UGraphicGizmos::DrawUTF8TextString(
const char* inText,
const FontInfo* inFontInfo,
SInt16 inMargin,
const Rect& inBounds,
SInt16 inJustification,
Boolean inDoTruncate,
TruncCode inTruncWhere)
//----------------------------------------------------------------------------------------
{
Rect r = inBounds;
r.left += inMargin;
r.right -= inMargin;
PlaceUTF8TextInRect(inText,
strlen(inText),
r,
inJustification,
teCenter,
inFontInfo,
inDoTruncate,
inTruncWhere );
}
//----------------------------------------------------------------------------------------
void UGraphicGizmos::PlaceUTF8TextInRect(
const char* inText,
Uint32 inTextLength,
const Rect &inRect,
Int16 inHorizJustType,
Int16 inVertJustType,
const FontInfo* /*inFontInfo*/,
Boolean inDoTruncate,
TruncCode /*inTruncWhere*/)
//----------------------------------------------------------------------------------------
{
FontInfo utf8FontInfo;
UFontSwitcher *fs;
UMultiFontTextHandler *th;
th = UUTF8TextHandler::Instance();
fs = UPropFontSwitcher::Instance();
th->GetFontInfo(fs, &utf8FontInfo);
const char* text = inText;
short length = inTextLength;
if (inDoTruncate)
{
// ¥¥ Fix ME: Don't know how to do text truncation for UTF8 now.
}
Point thePoint = UGraphicGizmos::CalcStringPosition(
inRect,
th->TextWidth(fs, (char*)text, length),
inHorizJustType,
inVertJustType,
&utf8FontInfo);
::MoveTo(thePoint.h, thePoint.v);
th->DrawText(fs, (char*)text ,length);
} // CThreadView::PlaceUTF8TextInRect
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ

Просмотреть файл

@ -181,6 +181,24 @@ class UGraphicGizmos
Boolean inDoTruncate = false,
TruncCode inTruncWhere = truncMiddle);
static void DrawUTF8TextString( const char* inText,
const FontInfo* inFontInfo,
SInt16 inMargin,
const Rect& inBounds,
SInt16 inJustification = teFlushLeft,
Boolean doTruncate = true,
TruncCode truncWhere = truncMiddle);
static void PlaceUTF8TextInRect(
const char* inText,
Uint32 inTextLength,
const Rect &inRect,
Int16 inHorizJustType = teCenter,
Int16 inVertJustType = teCenter,
const FontInfo* inFontInfo = NULL,
Boolean inDoTruncate = false,
TruncCode inTruncWhere = truncMiddle);
static Point CalcStringPosition(
const Rect &inRect,
Int16 inStringWidth,