* implemented "false bold" for text rendering. It is a new property

of BFont. You can BFont::SetFalseBoldWidth(float) a width on a
  BFont object, and it will cause the glyph shapes to be run through
  an AGG "contour converter" so that they become thicker or thinner.
  IIRC, this is commonly referred to as "false bold". The "width" value
  is the distance in pixels that the new glyph outline will be offset
  from the original outline.

It would be nice if someone could look at my change to View.h with
regards to the B_FONT_ALL flag.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19547 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2006-12-18 05:22:13 +00:00
parent c3a89b90d3
commit 10f6ed940b
9 changed files with 149 additions and 82 deletions

View File

@ -153,6 +153,7 @@ class BFont {
void SetSize(float size);
void SetShear(float shear);
void SetRotation(float rotation);
void SetFalseBoldWidth(float width);
void SetSpacing(uint8 spacing);
void SetEncoding(uint8 encoding);
void SetFace(uint16 face);
@ -164,6 +165,7 @@ class BFont {
float Size() const;
float Shear() const;
float Rotation() const;
float FalseBoldWidth() const;
uint8 Spacing() const;
uint8 Encoding() const;
uint16 Face() const;
@ -239,13 +241,14 @@ class BFont {
float fSize;
float fShear;
float fRotation;
float fFalseBoldWidth;
uint8 fSpacing;
uint8 fEncoding;
uint16 fFace;
uint32 fFlags;
mutable font_height fHeight;
mutable uint32 fExtraFlags;
uint32 _reserved[2];
uint32 _reserved[1];
void _GetExtraFlags() const;
void _GetBoundingBoxes(const char charArray[],

View File

@ -61,7 +61,8 @@ enum {
B_FONT_ENCODING = 0x00000020,
B_FONT_FACE = 0x00000040,
B_FONT_FLAGS = 0x00000080,
B_FONT_ALL = 0x000000FF
B_FONT_FALSE_BOLD_WIDTH = 0x00000100,
B_FONT_ALL = 0x000001FF
};
// view flags

View File

@ -6,6 +6,7 @@
* DarkWyrm <bpmagic@columbus.rr.com>
* Jérôme Duval, jerome.duval@free.fr
* Axel Dörfler, axeld@pinc-software.de
* Stephan Aßmus <superstippi@gmx.de>
*/
@ -508,6 +509,7 @@ BFont::BFont()
fSize(10.0),
fShear(90.0),
fRotation(0.0),
fFalseBoldWidth(0.0),
fSpacing(0),
fEncoding(0),
fFace(0),
@ -583,10 +585,11 @@ BFont::SetFamilyAndStyle(const font_family family, const font_style style)
void
BFont::SetFamilyAndStyle(uint32 fontcode)
{
// R5 has a bug here: the face is not updated even though the IDs are set. This
// is a problem because the face flag includes Regular/Bold/Italic information in
// addition to stuff like underlining and strikethrough. As a result, this will
// need a trip to the server and, thus, be slower than R5's in order to be correct
// R5 has a bug here: the face is not updated even though the IDs are set.
// This is a problem because the face flag includes Regular/Bold/Italic
// information in addition to stuff like underlining and strikethrough.
// As a result, this will need a trip to the server and, thus, be slower
// than R5's in order to be correct
uint16 family, style;
style = fontcode & 0xFFFF;
@ -618,9 +621,10 @@ BFont::SetFamilyAndStyle(uint32 fontcode)
\param face Font face to set.
\return B_ERROR if family does not exists or face is an invalid value.
To comply with the BeBook, this function will only set valid values - i.e. passing a
nonexistent family will cause only the face to be set. Additionally, if a particular
face does not exist in a family, the closest match will be chosen.
To comply with the BeBook, this function will only set valid values - i.e.
passing a nonexistent family will cause only the face to be set.
Additionally, if a particular face does not exist in a family, the closest
match will be chosen.
*/
status_t
@ -672,6 +676,13 @@ BFont::SetRotation(float rotation)
}
void
BFont::SetFalseBoldWidth(float width)
{
fFalseBoldWidth = width;
}
void
BFont::SetSpacing(uint8 spacing)
{
@ -766,6 +777,13 @@ BFont::Rotation() const
}
float
BFont::FalseBoldWidth() const
{
return fFalseBoldWidth;
}
uint8
BFont::Spacing() const
{
@ -811,10 +829,11 @@ BFont::IsFixed() const
/*!
\brief Returns true if the font is fixed-width and contains both full and half-width characters
\brief Returns true if the font is fixed-width and contains both full
and half-width characters
This was left unimplemented as of R5. It was a way to work with both Kanji and Roman
characters in the same fixed-width font.
This was left unimplemented as of R5. It was a way to work with both
Kanji and Roman characters in the same fixed-width font.
*/
bool
@ -918,7 +937,8 @@ void
BFont::TruncateString(BString *inOut, uint32 mode, float width) const
{
// NOTE: Careful, we cannot directly use "inOut->String()" as result
// array, because the string length increases by 3 bytes in the worst case scenario.
// array, because the string length increases by 3 bytes in the worst
// case scenario.
const char *string = inOut->String();
GetTruncatedStrings(&string, 1, mode, width, inOut);
}
@ -935,7 +955,8 @@ BFont::GetTruncatedStrings(const char *stringArray[], int32 numStrings,
truncatedStrings[i] = new char[strlen(stringArray[i]) + 3];
}
GetTruncatedStrings(stringArray, numStrings, mode, width, truncatedStrings);
GetTruncatedStrings(stringArray, numStrings, mode, width,
truncatedStrings);
// copy the strings into the BString array and free each one
for (int32 i = 0; i < numStrings; i++) {
@ -963,7 +984,8 @@ BFont::GetTruncatedStrings(const char *stringArray[], int32 numStrings,
GetEscapements(stringArray[i], numChars, NULL, escapementArray);
truncate_string(stringArray[i], mode, width, resultArray[i],
escapementArray, fSize, ellipsisWidth, length, numChars);
escapementArray, fSize, ellipsisWidth, length,
numChars);
delete[] escapementArray;
}
@ -1199,6 +1221,7 @@ BFont::_GetBoundingBoxes(const char charArray[], int32 numChars, font_metric_mod
link.Attach<float>(fSize);
link.Attach<float>(fRotation);
link.Attach<float>(fShear);
link.Attach<float>(fFalseBoldWidth);
link.Attach<uint8>(fSpacing);
link.Attach<uint32>(fFlags);
@ -1241,6 +1264,7 @@ BFont::GetBoundingBoxesForStrings(const char *stringArray[], int32 numStrings,
link.Attach<float>(fSize);
link.Attach<float>(fRotation);
link.Attach<float>(fShear);
link.Attach<float>(fFalseBoldWidth);
link.Attach<uint8>(fSpacing);
link.Attach<uint32>(fFlags);
link.Attach<font_metric_mode>(mode);
@ -1284,6 +1308,7 @@ BFont::GetGlyphShapes(const char charArray[], int32 numChars, BShape *glyphShape
link.Attach<float>(fSize);
link.Attach<float>(fShear);
link.Attach<float>(fRotation);
link.Attach<float>(fFalseBoldWidth);
link.Attach<uint32>(fFlags);
link.Attach<int32>(numChars);
@ -1334,6 +1359,7 @@ BFont::operator=(const BFont &font)
fSize = font.fSize;
fShear = font.fShear;
fRotation = font.fRotation;
fFalseBoldWidth = font.fFalseBoldWidth;
fSpacing = font.fSpacing;
fEncoding = font.fEncoding;
fFace = font.fFace;
@ -1351,6 +1377,7 @@ BFont::operator==(const BFont &font) const
&& fSize == font.fSize
&& fShear == font.fShear
&& fRotation == font.fRotation
&& fFalseBoldWidth == font.fFalseBoldWidth
&& fSpacing == font.fSpacing
&& fEncoding == font.fEncoding
&& fFace == font.fFace;
@ -1365,6 +1392,7 @@ BFont::operator!=(const BFont &font) const
|| fSize != font.fSize
|| fShear != font.fShear
|| fRotation != font.fRotation
|| fFalseBoldWidth != font.fFalseBoldWidth
|| fSpacing != font.fSpacing
|| fEncoding != font.fEncoding
|| fFace != font.fFace;

View File

@ -158,14 +158,10 @@ ViewState::UpdateServerFontState(BPrivate::PortLink &link)
{
link.StartMessage(AS_LAYER_SET_FONT_STATE);
link.Attach<uint16>(font_flags);
// always present
// always present.
if (font_flags & B_FONT_FAMILY_AND_STYLE) {
uint32 fontID;
fontID = font.FamilyAndStyle();
link.Attach<uint32>(fontID);
}
if (font_flags & B_FONT_FAMILY_AND_STYLE)
link.Attach<uint32>(font.FamilyAndStyle());
if (font_flags & B_FONT_SIZE)
link.Attach<float>(font.Size());
@ -176,6 +172,9 @@ ViewState::UpdateServerFontState(BPrivate::PortLink &link)
if (font_flags & B_FONT_ROTATION)
link.Attach<float>(font.Rotation());
if (font_flags & B_FONT_FALSE_BOLD_WIDTH)
link.Attach<float>(font.FalseBoldWidth());
if (font_flags & B_FONT_SPACING)
link.Attach<uint8>(font.Spacing());
@ -244,6 +243,7 @@ ViewState::UpdateFrom(BPrivate::PortLink &link)
float size;
float shear;
float rotation;
float falseBoldeWidth;
uint8 spacing;
uint8 encoding;
uint16 face;
@ -254,6 +254,7 @@ ViewState::UpdateFrom(BPrivate::PortLink &link)
link.Read<float>(&size);
link.Read<float>(&shear);
link.Read<float>(&rotation);
link.Read<float>(&falseBoldeWidth);
link.Read<int8>((int8 *)&spacing);
link.Read<int8>((int8 *)&encoding);
link.Read<int16>((int16 *)&face);
@ -264,6 +265,7 @@ ViewState::UpdateFrom(BPrivate::PortLink &link)
font.SetSize(size);
font.SetShear(shear);
font.SetRotation(rotation);
font.SetFalseBoldWidth(falseBoldeWidth);
font.SetSpacing(spacing);
font.SetEncoding(encoding);
font.SetFace(face);
@ -2102,6 +2104,9 @@ BView::SetFont(const BFont* font, uint32 mask)
if (mask & B_FONT_ROTATION)
fState->font.SetRotation(font->Rotation());
if (mask & B_FONT_FALSE_BOLD_WIDTH)
fState->font.SetFalseBoldWidth(font->FalseBoldWidth());
if (mask & B_FONT_SPACING)
fState->font.SetSpacing(font->Spacing());
@ -2115,7 +2120,7 @@ BView::SetFont(const BFont* font, uint32 mask)
fState->font.SetFlags(font->Flags());
}
fState->font_flags = mask;
fState->font_flags |= mask;
if (fOwner) {
check_lock();

View File

@ -158,6 +158,12 @@ DrawState::ReadFontFromLink(BPrivate::LinkReceiver& link)
fFont.SetRotation(rotation);
}
if (mask & B_FONT_FALSE_BOLD_WIDTH) {
float falseBoldWidth;
link.Read<float>(&falseBoldWidth);
fFont.SetFalseBoldWidth(falseBoldWidth);
}
if (mask & B_FONT_SPACING) {
uint8 spacing;
link.Read<uint8>(&spacing);
@ -237,6 +243,7 @@ DrawState::WriteToLink(BPrivate::LinkSender& link) const
link.Attach<float>(fFont.Size());
link.Attach<float>(fFont.Shear());
link.Attach<float>(fFont.Rotation());
link.Attach<float>(fFont.FalseBoldWidth());
link.Attach<uint8>(fFont.Spacing());
link.Attach<uint8>(fFont.Encoding());
link.Attach<uint16>(fFont.Face());

View File

@ -53,6 +53,7 @@
#include <ServerProtocol.h>
#include <WindowPrivate.h>
#include <new>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
@ -1346,6 +1347,8 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
int32 lengthArray[numStrings];
char *stringArray[numStrings];
for (int32 i = 0; i < numStrings; i++) {
// TODO: who allocates the strings?!? If the link does it then we are leaking
// everywhere else!!
link.ReadString(&stringArray[i], (size_t *)&lengthArray[i]);
}
@ -1504,6 +1507,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
// 3) float - point size
// 4) float - shear
// 5) float - rotation
// 6) float - false bold width
// 6) uint32 - flags
// 7) int32 - numChars
// 8) int32 - numBytes
@ -1515,20 +1519,21 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
uint16 familyID, styleID;
uint32 flags;
float size, shear, rotation;
float size, shear, rotation, falseBoldWidth;
link.Read<uint16>(&familyID);
link.Read<uint16>(&styleID);
link.Read<float>(&size);
link.Read<float>(&shear);
link.Read<float>(&rotation);
link.Read<float>(&falseBoldWidth);
link.Read<uint32>(&flags);
int32 numChars, numBytes;
link.Read<int32>(&numChars);
link.Read<int32>(&numBytes);
char *charArray = new char[numBytes];
char* charArray = new (nothrow) char[numBytes];
link.Read(charArray, numBytes);
ServerFont font;
@ -1537,9 +1542,10 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
font.SetSize(size);
font.SetShear(shear);
font.SetRotation(rotation);
font.SetFalseBoldWidth(falseBoldWidth);
font.SetFlags(flags);
BShape **shapes = new BShape *[numChars];
BShape** shapes = new (nothrow) BShape*[numChars];
status = font.GetGlyphShapes(charArray, numChars, shapes);
if (status == B_OK) {
fLink.StartMessage(B_OK);
@ -1547,10 +1553,10 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
fLink.AttachShape(*shapes[i]);
delete shapes[i];
}
delete[] shapes;
} else
fLink.StartMessage(status);
delete[] shapes;
} else
fLink.StartMessage(status);
@ -1575,7 +1581,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
int32 numChars, numBytes;
link.Read<int32>(&numChars);
link.Read<int32>(&numBytes);
char* charArray = new char[numBytes];
char* charArray = new (nothrow) char[numBytes];
link.Read(charArray, numBytes);
ServerFont font;
@ -1614,7 +1620,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
uint32 numBytes;
link.Read<uint32>(&numBytes);
char* charArray = new char[numBytes];
char* charArray = new (nothrow) char[numBytes];
link.Read(charArray, numBytes);
ServerFont font;
@ -1676,7 +1682,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
uint32 numBytes;
link.Read<uint32>(&numBytes);
char *charArray = new char[numBytes];
char *charArray = new (nothrow) char[numBytes];
link.Read(charArray, numBytes);
ServerFont font;
@ -1687,10 +1693,10 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
font.SetRotation(rotation);
font.SetFlags(flags);
BPoint *escapements = new BPoint[numChars];
BPoint *escapements = new (nothrow) BPoint[numChars];
BPoint *offsets = NULL;
if (wantsOffsets)
offsets = new BPoint[numChars];
offsets = new (nothrow) BPoint[numChars];
status = font.GetEscapements(charArray, numChars, delta,
escapements, offsets);
@ -1700,16 +1706,16 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
for (int32 i = 0; i < numChars; i++)
fLink.Attach<BPoint>(escapements[i]);
delete[] escapements;
if (wantsOffsets) {
for (int32 i = 0; i < numChars; i++)
fLink.Attach<BPoint>(offsets[i]);
delete[] offsets;
}
} else
fLink.StartMessage(status);
delete[] escapements;
delete[] offsets;
} else
fLink.StartMessage(status);
@ -1759,10 +1765,10 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
uint32 numBytes;
link.Read<uint32>(&numBytes);
char* charArray = new char[numBytes];
char* charArray = new (nothrow) char[numBytes];
link.Read(charArray, numBytes);
float* escapements = new float[numChars];
float* escapements = new (nothrow) float[numChars];
// figure out escapements
@ -1801,24 +1807,25 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
// 3) float - point size
// 4) float - rotation
// 5) float - shear
// 6) uint8 - spacing
// 7) uint32 - flags
// 6) float - false bold width
// 7) uint8 - spacing
// 8) uint32 - flags
// 8) font_metric_mode - mode
// 9) bool - string escapement
// 9) font_metric_mode - mode
// 10) bool - string escapement
// 10) escapement_delta - additional delta
// 11) escapement_delta - additional delta
// 11) int32 - numChars
// 12) int32 - numBytes
// 13) char - the char buffer with size numBytes
// 12) int32 - numChars
// 13) int32 - numBytes
// 14) char - the char buffer with size numBytes
// Returns:
// 1) BRect - rects with numChar entries
uint16 famid, styid;
uint32 flags;
float ptsize, rotation, shear;
float ptsize, rotation, shear, falseBoldWidth;
uint8 spacing;
font_metric_mode mode;
bool string_escapement;
@ -1828,6 +1835,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
link.Read<float>(&ptsize);
link.Read<float>(&rotation);
link.Read<float>(&shear);
link.Read<float>(&falseBoldWidth);
link.Read<uint8>(&spacing);
link.Read<uint32>(&flags);
link.Read<font_metric_mode>(&mode);
@ -1842,7 +1850,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
uint32 numBytes;
link.Read<uint32>(&numBytes);
char *charArray = new char[numBytes];
char *charArray = new (nothrow) char[numBytes];
link.Read(charArray, numBytes);
BRect rectArray[numChars];
@ -1854,6 +1862,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
font.SetSize(ptsize);
font.SetRotation(rotation);
font.SetShear(shear);
font.SetFalseBoldWidth(falseBoldWidth);
font.SetSpacing(spacing);
font.SetFlags(flags);
@ -1882,22 +1891,23 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
// 3) float - point size
// 4) float - rotation
// 5) float - shear
// 6) uint8 - spacing
// 7) uint32 - flags
// 6) float - false bold width
// 7) uint8 - spacing
// 8) uint32 - flags
// 8) font_metric_mode - mode
// 9) int32 numStrings
// 9) font_metric_mode - mode
// 10) int32 numStrings
// 10) escapement_delta - additional delta (numStrings times)
// 11) int32 string length to measure (numStrings times)
// 12) string - string (numStrings times)
// 11) escapement_delta - additional delta (numStrings times)
// 12) int32 string length to measure (numStrings times)
// 13) string - string (numStrings times)
// Returns:
// 1) BRect - rects with numStrings entries
uint16 famid, styid;
uint32 flags;
float ptsize, rotation, shear;
float ptsize, rotation, shear, falseBoldWidth;
uint8 spacing;
font_metric_mode mode;
@ -1906,6 +1916,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
link.Read<float>(&ptsize);
link.Read<float>(&rotation);
link.Read<float>(&shear);
link.Read<float>(&falseBoldWidth);
link.Read<uint8>(&spacing);
link.Read<uint32>(&flags);
link.Read<font_metric_mode>(&mode);
@ -1930,6 +1941,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
font.SetSize(ptsize);
font.SetRotation(rotation);
font.SetShear(shear);
font.SetFalseBoldWidth(falseBoldWidth);
font.SetSpacing(spacing);
font.SetFlags(flags);
@ -2456,11 +2468,11 @@ ServerApp::_CreateWindow(int32 code, BPrivate::LinkReceiver& link,
ServerBitmap* bitmap = FindBitmap(bitmapToken);
if (bitmap != NULL) {
window = new OffscreenServerWindow(title, this, clientReplyPort,
window = new (nothrow) OffscreenServerWindow(title, this, clientReplyPort,
looperPort, token, bitmap);
}
} else {
window = new ServerWindow(title, this, clientReplyPort, looperPort, token);
window = new (nothrow) ServerWindow(title, this, clientReplyPort, looperPort, token);
STRACE(("\nServerApp %s: New Window %s (%g:%g, %g:%g)\n",
Signature(), title, frame.left, frame.top,
frame.right, frame.bottom));

View File

@ -113,12 +113,13 @@ is_white_space(uint32 charCode)
\param spacing String spacing flag as defined in <Font.h>
*/
ServerFont::ServerFont(FontStyle& style, float size,
float rotation, float shear,
float rotation, float shear, float falseBoldWidth,
uint16 flags, uint8 spacing)
: fStyle(&style),
fSize(size),
fRotation(rotation),
fShear(shear),
fFalseBoldWidth(falseBoldWidth),
fBounds(0, 0, 0, 0),
fFlags(flags),
fSpacing(spacing),
@ -168,13 +169,14 @@ ServerFont&
ServerFont::operator=(const ServerFont& font)
{
if (font.fStyle) {
fSize = font.fSize;
fRotation = font.fRotation;
fShear = font.fShear;
fFlags = font.fFlags;
fSpacing = font.fSpacing;
fEncoding = font.fEncoding;
fBounds = font.fBounds;
fSize = font.fSize;
fRotation = font.fRotation;
fShear = font.fShear;
fFalseBoldWidth = font.fFalseBoldWidth;
fFlags = font.fFlags;
fSpacing = font.fSpacing;
fEncoding = font.fEncoding;
fBounds = font.fBounds;
SetStyle(font.fStyle);
}

View File

@ -25,8 +25,9 @@ class ServerFont {
ServerFont();
ServerFont(FontStyle& style,
float size = 12.0,
float fRotation = 0.0,
float fShear = 90.0,
float rotation = 0.0,
float shear = 90.0,
float falseBoldWidth = 0.0,
uint16 flags = 0,
uint8 spacing = B_CHAR_SPACING);
ServerFont(const ServerFont& font);
@ -48,6 +49,8 @@ class ServerFont {
{ return fShear; }
float Rotation() const
{ return fRotation; }
float FalseBoldWidth() const
{ return fFalseBoldWidth; }
float Size() const
{ return fSize; }
uint16 Face() const
@ -90,6 +93,8 @@ class ServerFont {
{ fSize = value; }
void SetRotation(float value)
{ fRotation = value; }
void SetFalseBoldWidth(float value)
{ fFalseBoldWidth = value; }
void SetFace(uint32 face);
bool IsFixedWidth() const
@ -162,6 +167,7 @@ protected:
float fSize;
float fRotation;
float fShear;
float fFalseBoldWidth;
BRect fBounds;
uint32 fFlags;
uint32 fSpacing;

View File

@ -120,12 +120,15 @@ AGGTextRenderer::SetFont(const ServerFont &font)
-font.Rotation() * PI / 180.0);
agg::glyph_rendering glyphType =
fHinted && fEmbeddedTransformation.IsIdentity() ?
fHinted && fEmbeddedTransformation.IsIdentity()
&& font.FalseBoldWidth() == 0.0 ?
agg::glyph_ren_native_gray8 :
agg::glyph_ren_outline;
fFontEngine.load_font(font, glyphType, font.Size());
fContour.width(font.FalseBoldWidth() * 2.0);
return true;
}
@ -188,6 +191,11 @@ AGGTextRenderer::RenderString(const char* string,
conv_font_trans_type;
conv_font_trans_type transformedOutline(fCurves, transform);
typedef agg::conv_transform<conv_font_contour_type, agg::trans_affine>
conv_font_contour_trans_type;
conv_font_contour_trans_type transformedContourOutline(fContour, transform);
float falseBoldWidth = fContour.width();
double x = 0.0;
double y0 = 0.0;
double y = y0;
@ -267,6 +275,8 @@ AGGTextRenderer::RenderString(const char* string,
glyphBounds.OffsetBy(transformOffset);
} else {
fFontCache.init_embedded_adaptors(glyph, x, y);
if (falseBoldWidth != 0.0)
glyphBounds.InsetBy(-falseBoldWidth, -falseBoldWidth);
glyphBounds = transform.TransformBounds(glyphBounds);
}
@ -284,16 +294,13 @@ AGGTextRenderer::RenderString(const char* string,
case agg::glyph_data_outline: {
fRasterizer.reset();
// NOTE: this function can be easily extended to handle
// conversion to contours, so that's why there is a lot of
// commented out code, I leave it here because I think it
// will be needed again.
//if(fabs(0.0) <= 0.01) {
// For the sake of efficiency skip the
// contour converter if the weight is about zero.
if (fContour.width() == 0.0) {
fRasterizer.add_path(transformedOutline);
} else {
fRasterizer.add_path(transformedContourOutline);
}
#if SHOW_GLYPH_BOUNDS
agg::path_storage p;
p.move_to(glyphBounds.left + 0.5, glyphBounds.top + 0.5);
@ -305,10 +312,6 @@ AGGTextRenderer::RenderString(const char* string,
ps.width(1.0);
fRasterizer.add_path(ps);
#endif
/*} else {
//fRasterizer.add_path(fContour);
fRasterizer.add_path(transformedOutline);
}*/
agg::render_scanlines(fRasterizer, fScanline, *solidRenderer);
break;