#include FT_BBOX_H
#include FT_TRUETYPE_TAGS_H
/*
- * If you want to use FT_Outline_Get_CBox instead of
+ * If you want to use FT_Outline_Get_CBox instead of
* FT_Outline_Get_BBox, define here.
*/
/* #define USE_GET_CBOX */
/* The propery names for all the XLFD properties. */
-static char *xlfd_props[] = {
+static const char *xlfd_props[] = {
"FOUNDRY",
"FAMILY_NAME",
"WEIGHT_NAME",
FT_ULong len = sizeof(buff);
FT_UShort result = 0;
- if ( !FT_Load_Sfnt_Table( face, table_tag, table_offset, buff, &len ) );
+ if ( !FT_Load_Sfnt_Table( face, table_tag, table_offset, buff, &len ) )
result = (FT_UShort)( (buff[0] << 8) | buff[1] );
return result;
{
return ifloor(x + y - 1, y);
}
-
+
static int
FreeTypeOpenFace(FTFacePtr *facep, char *FTFileName, char *realFileName, int faceNumber)
{
else if(t1->nonIdentity != t2->nonIdentity)
return 0;
else if(t1->nonIdentity && t2->nonIdentity) {
- return
+ return
t1->matrix.xx == t2->matrix.xx &&
t1->matrix.yx == t2->matrix.yx &&
t1->matrix.yy == t2->matrix.yy &&
t1->flags == t2->flags &&
t1->scaleBitmap == t2->scaleBitmap &&
/*
- If we use forceConstantSpacing,
+ If we use forceConstantSpacing,
we *MUST* allocate new instance.
*/
t1->forceConstantSpacingEnd < 0 &&
FTInstanceMatch(FTInstancePtr instance,
char *FTFileName, FTNormalisedTransformationPtr trans,
int spacing, FontBitmapFormatPtr bmfmt,
- struct TTCapInfo *tmp_ttcap, FT_Int32 load_flags)
+ struct TTCapInfo *tmp_ttcap, FT_Int32 load_flags)
{
if(strcmp(instance->face->filename, FTFileName) != 0) {
return 0;
instance->transformation.nonIdentity ?
&instance->transformation.matrix : 0,
0);
-
+
instance->face->active_instance = instance;
return Successful;
}
j = i;
d = dd;
}
- }
+ }
}
if(j < 0)
return BadFontName;
/* maintain a linked list of instances */
instance->next = instance->face->instances;
instance->face->instances = instance;
-
+
*instance_return = instance;
return Successful;
}
instance->refcount--;
if(instance->refcount <= 0) {
int i,j;
-
+
if(instance->face->instances == instance)
instance->face->instances = instance->next;
else {
for(i = 0; i < iceil(instance->nglyphs, FONTSEGMENTSIZE); i++) {
if(instance->glyphs[i]) {
for(j = 0; j < FONTSEGMENTSIZE; j++) {
- if(instance->available[i][j] ==
+ if(instance->available[i][j] ==
FT_AVAILABLE_RASTERISED)
free(instance->glyphs[i][j].bits);
}
*found = 0;
return Successful;
}
-
+
if(*available == NULL) {
*available = calloc(iceil(instance->nglyphs, FONTSEGMENTSIZE),
sizeof(int *));
int xrc;
int ***available;
CharInfoPtr **glyphs;
-
+
available = &instance->available;
glyphs = &instance->glyphs;
if(!found || (*available)[segment][offset] == FT_AVAILABLE_NO) {
*g = NULL;
return Successful;
- }
+ }
if((*available)[segment][offset] == FT_AVAILABLE_RASTERISED) {
*g = &(*glyphs)[segment][offset];
return Successful;
}
-
+
flags |= FT_GET_GLYPH_BOTH;
- xrc = FreeTypeRasteriseGlyph(idx, flags,
- &(*glyphs)[segment][offset], instance,
+ xrc = FreeTypeRasteriseGlyph(idx, flags,
+ &(*glyphs)[segment][offset], instance,
(*available)[segment][offset] >= FT_AVAILABLE_METRICS);
if(xrc != Successful && (*available)[segment][offset] >= FT_AVAILABLE_METRICS) {
ErrorF("Warning: FreeTypeRasteriseGlyph() returns an error,\n");
{
int xrc;
int found, segment, offset;
-
+
/* Char cell */
if(instance->spacing == FT_CHARCELL) {
*metrics = instance->charcellMetrics;
/* Not char cell */
- xrc = FreeTypeInstanceFindGlyph(idx, flags, instance,
- &instance->glyphs, &instance->available,
+ xrc = FreeTypeInstanceFindGlyph(idx, flags, instance,
+ &instance->glyphs, &instance->available,
&found, &segment, &offset);
if(xrc != Successful)
return xrc;
if( instance->available[segment][offset] == FT_AVAILABLE_NO ) {
*metrics = NULL;
return Successful;
- }
+ }
if( instance->available[segment][offset] >= FT_AVAILABLE_METRICS ) {
*metrics = &instance->glyphs[segment][offset].metrics;
return Successful;
}
-
+
flags |= FT_GET_GLYPH_METRICS_ONLY;
- xrc = FreeTypeRasteriseGlyph(idx, flags,
+ xrc = FreeTypeRasteriseGlyph(idx, flags,
&instance->glyphs[segment][offset],
instance, 0);
if(xrc == Successful) {
}
return xrc;
}
-
+
/*
* Pseudo enbolding similar as Microsoft Windows.
* It is useful but poor.
tmp_shift %= 8;
if ( tmp_shift ) {
for (x=bpr-1;0<=x;x--) {
- if ( x != bpr-1 )
+ if ( x != bpr-1 )
tmp_p[x+1] |= tmp_p[x]<<(8-tmp_shift);
tmp_p[x]>>=tmp_shift;
}
tmp_shift %= 8;
if ( tmp_shift ) {
for (x=0;x<bpr;x++) {
- if ( x != 0 )
+ if ( x != 0 )
tmp_p[x-1] |= tmp_p[x]>>(8-tmp_shift);
tmp_p[x]<<=tmp_shift;
}
}
}
-static int
+static int
ft_get_very_lazy_bbox( FT_UInt index,
FT_Face face,
FT_Size size,
metrics_return->horiBearingX = (FT_Pos)elem_metrics.horiBearingX << 6;
metrics_return->horiBearingY = (FT_Pos)elem_metrics.horiBearingY << 6;
metrics_return->horiAdvance = (FT_Pos)elem_metrics.horiAdvance << 6;
-
+
metrics_return->vertBearingX = (FT_Pos)elem_metrics.vertBearingX << 6;
metrics_return->vertBearingY = (FT_Pos)elem_metrics.vertBearingY << 6;
metrics_return->vertAdvance = (FT_Pos)elem_metrics.vertAdvance << 6;
if(!hasMetrics) {
if( instance->spacing == FT_CHARCELL || flags & FT_GET_DUMMY ){
- memcpy((char*)&tgp->metrics,
+ memcpy((char*)&tgp->metrics,
(char*)instance->charcellMetrics,
sizeof(xCharInfo));
}
else if( flags & FT_FORCE_CONSTANT_SPACING ) {
- memcpy((char*)&tgp->metrics,
+ memcpy((char*)&tgp->metrics,
(char*)instance->forceConstantMetrics,
sizeof(xCharInfo));
}
}
if( bitmap_metrics == NULL ) {
if ( sbitchk_incomplete_but_exist==0 && (instance->ttcap.flags & TTCAP_IS_VERY_LAZY) ) {
- if( ft_get_very_lazy_bbox( idx, face->face, instance->size,
+ if( ft_get_very_lazy_bbox( idx, face->face, instance->size,
face->num_hmetrics,
instance->ttcap.vl_slant,
&instance->transformation.matrix,
- &bbox, &outline_hori_advance,
+ &bbox, &outline_hori_advance,
&outline_vert_advance ) == 0 ) {
goto bbox_ok; /* skip exact calculation */
}
}
- ftrc = FT_Load_Glyph(instance->face->face, idx,
+ ftrc = FT_Load_Glyph(instance->face->face, idx,
instance->load_flags);
if(ftrc != 0) return FTtoXReturnCode(ftrc);
metrics = &face->face->glyph->metrics;
if( bitmap_metrics ) {
FT_Pos factor;
-
+
leftSideBearing = bitmap_metrics->horiBearingX / 64;
rightSideBearing = (bitmap_metrics->width + bitmap_metrics->horiBearingX) / 64;
bbox_center_raw = (2.0 * bitmap_metrics->horiBearingX + bitmap_metrics->width)/2.0/64.0;
- characterWidth = (int)floor(bitmap_metrics->horiAdvance
+ characterWidth = (int)floor(bitmap_metrics->horiAdvance
* instance->ttcap.scaleBBoxWidth / 64.0 + .5);
ascent = bitmap_metrics->horiBearingY / 64;
descent = (bitmap_metrics->height - bitmap_metrics->horiBearingY) / 64 ;
bbox_center_raw = (double)(bbox.xMax + bbox.xMin)/2.0/64.;
if ( instance->pixel_width_unit_x != 0 )
characterWidth =
- (int)floor( outline_hori_advance
+ (int)floor( outline_hori_advance
* instance->ttcap.scaleBBoxWidth
* instance->pixel_width_unit_x / 64. + .5);
else {
- characterWidth =
+ characterWidth =
(int)floor( outline_vert_advance
* instance->ttcap.scaleBBoxHeight
* instance->pixel_width_unit_y / 64. + .5);
characterWidth = new_width;
if ( instance->pixel_width_unit_x != 0 )
rawCharacterWidth =
- (unsigned short)(short)(floor(1000 * outline_hori_advance
+ (unsigned short)(short)(floor(1000 * outline_hori_advance
* instance->ttcap.scaleBBoxWidth * ratio
* instance->pixel_width_unit_x / 64.));
else {
rawCharacterWidth =
- (unsigned short)(short)(floor(1000 * outline_vert_advance
+ (unsigned short)(short)(floor(1000 * outline_vert_advance
* instance->ttcap.scaleBBoxHeight * ratio
* instance->pixel_width_unit_y / 64.));
if(rawCharacterWidth <= 0)
if( flags & FT_GET_DUMMY ) is_outline = -1;
else {
if( !metrics ) {
- ftrc = FT_Load_Glyph(instance->face->face, idx,
+ ftrc = FT_Load_Glyph(instance->face->face, idx,
instance->load_flags);
metrics = &face->face->glyph->metrics;
bbox.yMin = FLOOR64( bbox.yMin );
bbox.yMax = CEIL64 ( bbox.yMax );
ht_actual = ( bbox.yMax - bbox.yMin ) >> 6;
- /* FreeType think a glyph with 0 height control box is invalid.
+ /* FreeType think a glyph with 0 height control box is invalid.
* So just let X to create a empty bitmap instead. */
if ( ht_actual == 0 )
is_outline = -1;
if( (instance->ttcap.flags & TTCAP_MONO_CENTER) && hasMetrics ) {
if( is_outline == 1 ){
if( correct ){
- if( ft_get_very_lazy_bbox( idx, face->face, instance->size,
+ if( ft_get_very_lazy_bbox( idx, face->face, instance->size,
face->num_hmetrics,
instance->ttcap.vl_slant,
&instance->transformation.matrix,
- &bbox, &outline_hori_advance,
+ &bbox, &outline_hori_advance,
&outline_vert_advance ) != 0 ){
is_outline = -1; /* <- error */
}
if(ht_actual <= 0) ht = 1;
else ht=ht_actual;
- bpr = (((wd + (instance->bmfmt.glyph<<3) - 1) >> 3) &
+ bpr = (((wd + (instance->bmfmt.glyph<<3) - 1) >> 3) &
-instance->bmfmt.glyph);
raster = calloc(1, ht * bpr);
- if(raster == NULL)
+ if(raster == NULL)
return AllocError;
tgp->bits = raster;
if ( is_outline == 0 &&
( instance->ttcap.lsbShiftOfBitmapAutoItalic != 0 ||
instance->ttcap.rsbShiftOfBitmapAutoItalic != 0 ) ) {
- ft_make_up_italic_bitmap( raster, bpr, ht,
+ ft_make_up_italic_bitmap( raster, bpr, ht,
- instance->ttcap.lsbShiftOfBitmapAutoItalic
+ instance->ttcap.rsbShiftOfBitmapAutoItalic,
instance->charcellMetrics->ascent
- tgp->metrics.ascent,
instance->ttcap.autoItalic);
}
-
+
if(instance->bmfmt.bit == LSBFirst) {
BitOrderInvert((unsigned char*)(tgp->bits), ht*bpr);
}
-
+
if(instance->bmfmt.byte != instance->bmfmt.bit) {
switch(instance->bmfmt.scan) {
case 1:
FreeTypeFreeXFont(FontPtr pFont, int freeProps)
{
FTFontPtr tf;
-
+
if(pFont) {
if((tf = (FTFontPtr)pFont->fontPrivate)) {
FreeTypeFreeFont(tf);
used by Xaw. */
static int
-FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info,
+FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info,
char *fontname, int rawAverageWidth, Bool font_properties)
{
int i, j, maxprops;
}
info->nprops = 0; /* in case we abort */
-
+
strcpy(val, fontname);
if(FontParseXLFDName(val, vals, FONT_XLFD_REPLACE_VALUE)) {
xlfdProps = 1;
( (font_properties && os2) ? 6 : 0 ) +
( (font_properties && (post || t1info)) ? 3 : 0 ) +
2; /* type */
-
+
info->props = malloc(maxprops * sizeof(FontPropRec));
if(info->props == NULL)
return AllocError;
-
+
info->isStringProp = malloc(maxprops);
if(info->isStringProp == NULL) {
free(info->props);
for (ep = sp; *ep && *ep != '['; ep++);
else
for (ep = sp; *ep && *ep != '-'; ep++);
-
+
info->props[i].name =
MakeAtom(xlfd_props[j], strlen(xlfd_props[j]), TRUE);
-
+
switch(j) {
case 6: /* pixel size */
- info->props[i].value =
+ info->props[i].value =
(int)(fabs(vals->pixel_matrix[3]) + 0.5);
i++;
break;
case 7: /* point size */
- info->props[i].value =
+ info->props[i].value =
(int)(fabs(vals->point_matrix[3])*10.0 + 0.5);
i++;
break;
if(!face->bitmap) {
info->props[i].name = MakeAtom("RAW_ASCENT", 10, TRUE);
- info->props[i].value =
+ info->props[i].value =
((double)face->face->ascender/(double)upm*1000.0);
i++;
}
if(!face->bitmap) {
info->props[i].name = MakeAtom("RAW_DESCENT", 11, TRUE);
- info->props[i].value =
+ info->props[i].value =
-((double)face->face->descender/(double)upm*1000.0);
i++;
}
info->isStringProp[i] = 1;
i++;
}
-
+
j = FTGetEnglishName(face->face, TT_NAME_ID_FULL_NAME,
val, MAXFONTNAMELEN);
vp = val;
/* In what follows, we assume the matrix is diagonal. In the rare
case when it is not, the values will be somewhat wrong. */
-
+
if( font_properties && os2 ) {
info->props[i].name = MakeAtom("SUBSCRIPT_SIZE",14,TRUE);
- info->props[i].value =
+ info->props[i].value =
TRANSFORM_FUNITS_Y(os2->ySubscriptYSize);
i++;
info->props[i].name = MakeAtom("SUBSCRIPT_X",11,TRUE);
- info->props[i].value =
+ info->props[i].value =
TRANSFORM_FUNITS_X(os2->ySubscriptXOffset);
i++;
info->props[i].name = MakeAtom("SUBSCRIPT_Y",11,TRUE);
- info->props[i].value =
+ info->props[i].value =
TRANSFORM_FUNITS_Y(os2->ySubscriptYOffset);
i++;
info->props[i].name = MakeAtom("SUPERSCRIPT_SIZE",16,TRUE);
- info->props[i].value =
+ info->props[i].value =
TRANSFORM_FUNITS_Y(os2->ySuperscriptYSize);
i++;
info->props[i].name = MakeAtom("SUPERSCRIPT_X",13,TRUE);
- info->props[i].value =
+ info->props[i].value =
TRANSFORM_FUNITS_X(os2->ySuperscriptXOffset);
i++;
info->props[i].name = MakeAtom("SUPERSCRIPT_Y",13,TRUE);
- info->props[i].value =
+ info->props[i].value =
TRANSFORM_FUNITS_Y(os2->ySuperscriptYOffset);
i++;
}
if( font_properties && (post || t1info) ) {
int underlinePosition, underlineThickness;
- /* Raw underlineposition counts upwards,
+ /* Raw underlineposition counts upwards,
but UNDERLINE_POSITION counts downwards. */
if(post) {
underlinePosition = TRANSFORM_FUNITS_Y(-post->underlinePosition);
underlineThickness = TRANSFORM_FUNITS_Y(post->underlineThickness);
} else {
- underlinePosition =
+ underlinePosition =
TRANSFORM_FUNITS_Y(-t1info->underline_position);
- underlineThickness =
+ underlineThickness =
TRANSFORM_FUNITS_Y(t1info->underline_thickness);
}
if(underlineThickness <= 0)
/* The italic angle is often unreliable for Type 1 fonts */
if(post && trans->matrix.xx == trans->matrix.yy) {
info->props[i].name = MakeAtom("ITALIC_ANGLE",12,TRUE);
- info->props[i].value =
- /* Convert from TT_Fixed to
+ info->props[i].value =
+ /* Convert from TT_Fixed to
64th of a degree counterclockwise from 3 o'clock */
90*64+(post->italicAngle >> 10);
i++;
info->props[i].value = MakeAtom(vp, strlen(vp), TRUE);
info->isStringProp[i] = 1;
i++;
-
+
info->props[i].name = MakeAtom("RASTERIZER_NAME", 15, TRUE);
info->props[i].value = MakeAtom("FreeType", 10, TRUE);
info->isStringProp[i] = 1;
i++;
-
+
info->nprops = i;
return Successful;
}
static int
ft_get_index(unsigned code, FTFontPtr font, unsigned *idx)
{
-
+
/* As a special case, we pass 0 even when it is not in the ranges;
this will allow for the default glyph, which should exist in any
TrueType font. */
-
+
/* This is not required...
if(code > 0 && font->nranges) {
int i;
for(i = 0; i < font->nranges; i++)
- if((code >=
+ if((code >=
font->ranges[i].min_char_low+
(font->ranges[i].min_char_high<<8)) &&
(code <=
- font->ranges[i].max_char_low +
+ font->ranges[i].max_char_low +
(font->ranges[i].max_char_high<<8)))
break;
if(i == font->nranges) {
}
*idx = FTRemap(font->instance->face->face, &font->mapping, code);
-
+
return 0;
}
{
unsigned idx = 0;
int xrc;
-
+
#ifdef X_ACCEPTS_NO_SUCH_CHAR
if( ft_get_index(code,font,&idx) || idx == 0 || idx == font->zero_idx ) {
*g = NULL;
if( xrc == Successful && *metrics != NULL )
return Successful;
if( font->zero_idx != idx ) {
- xrc = FreeTypeInstanceGetGlyphMetrics(font->zero_idx, flags,
+ xrc = FreeTypeInstanceGetGlyphMetrics(font->zero_idx, flags,
metrics, font->instance);
if( xrc == Successful && *metrics != NULL )
return Successful;
}
/* *face_number and *spacing are initialized but *load_flags is NOT. */
-static int
+static int
FreeTypeSetUpTTCap( char *fileName, FontScalablePtr vals,
char **dynStrRealFileName, char **dynStrFTFileName,
struct TTCapInfo *ret, int *face_number, FT_Int32 *load_flags,
{
/* font cap */
char *p1=NULL, *p2=NULL;
-
+
p1=strrchr(fileName, '/');
if ( p1 == NULL ) p1 = fileName;
else p1++;
/* colon exist in the right side of slash. */
int dirLen = p1-fileName;
int baseLen = fileName+len - p2 -1;
-
+
*dynStrRealFileName = malloc(dirLen+baseLen+1);
if( *dynStrRealFileName == NULL ) {
result = AllocError;
fprintf(stderr,"[Filename:%s]\n",fileName);
fprintf(stderr,"[RealFilename:%s]\n",*dynStrRealFileName);
fprintf(stderr,"[FTFilename:%s]\n",*dynStrFTFileName);
- */
+ */
/* slant control */
if (SPropRecValList_search_record(&listPropRecVal,
&contRecValue,
semic_ptr=strchr(strMetrics,';');
comma_ptr=strchr(strMetrics,',');
period_ptr=strchr(strMetrics,'.');
- if ( semic_ptr && comma_ptr )
+ if ( semic_ptr && comma_ptr )
if ( semic_ptr < comma_ptr ) comma_ptr=NULL;
- if ( semic_ptr && period_ptr )
+ if ( semic_ptr && period_ptr )
if ( semic_ptr < period_ptr ) period_ptr=NULL;
if ( !comma_ptr && !period_ptr && strMetrics != semic_ptr ) {
if ( restrict_code_range_by_str(1,&first_col, &first_row,
&last_col, &last_row,
SPropContainer_value_str(contRecValue)) == 1 ) {
- ret->force_c_representative_metrics_char_code =
+ ret->force_c_representative_metrics_char_code =
(int)( first_row<<8 | first_col );
}
}
{
/* Compute the transformation matrix. We use floating-point
arithmetic for simplicity */
-
+
trans->xres = vals->x;
trans->yres = vals->y;
-
+
/* This value cannot be 0. */
trans->scale = hypot(vals->point_matrix[2], vals->point_matrix[3]);
trans->nonIdentity = 0;
-
+
/* Try to round stuff. We want approximate zeros to be exact zeros,
and if the elements on the diagonal are approximately equal, we
want them equal. We do this to avoid breaking hinting. */
((vals->point_matrix[0] + vals->point_matrix[3])/2*
(double)TWO_SIXTEENTH)/trans->scale;
}
-
+
if(DIFFER0(vals->point_matrix[1], trans->scale)) {
trans->matrix.yx =
(int)((vals->point_matrix[1]*(double)TWO_SIXTEENTH)/trans->scale);
trans->nonIdentity = 1;
} else
trans->matrix.yx = 0;
-
+
if(DIFFER0(vals->point_matrix[2], trans->scale)) {
trans->matrix.xy =
(int)((vals->point_matrix[2]*(double)TWO_SIXTEENTH)/trans->scale);
static int
FreeTypeLoadFont(FTFontPtr font, FontInfoPtr info, FTFacePtr face,
char *FTFileName, FontScalablePtr vals, FontEntryPtr entry,
- FontBitmapFormatPtr bmfmt, FT_Int32 load_flags,
+ FontBitmapFormatPtr bmfmt, FT_Int32 load_flags,
struct TTCapInfo *tmp_ttcap, char *dynStrTTCapCodeRange,
int ttcap_spacing )
{
if(entry->name.ndashes == 14) {
char *p;
int dashes = 0;
- for(p = entry->name.name;
+ for(p = entry->name.name;
p <= entry->name.name + entry->name.length - 2;
p++) {
if(*p == '-') {
if (xrc != Successful)
return xrc;
} else {
- xrc = FTPickMapping(0, 0, FTFileName,
+ xrc = FTPickMapping(0, 0, FTFileName,
face->face, &font->mapping);
if (xrc != Successful)
return xrc;
}
-
+
font->nranges = vals->nranges;
font->ranges = 0;
if(font->nranges) {
font->ranges = malloc(vals->nranges*sizeof(fsRange));
- if(font->ranges == NULL)
+ if(font->ranges == NULL)
return AllocError;
memcpy((char*)font->ranges, (char*)vals->ranges,
vals->nranges*sizeof(fsRange));
if(info) {
firstCode = 0;
lastCode = 0xFFFFL;
- if(!font->mapping.mapping ||
+ if(!font->mapping.mapping ||
font->mapping.mapping->encoding->row_size == 0) {
/* linear indexing */
lastCode=MIN(lastCode,
info->lastRow = MIN(font->mapping.mapping->encoding->size-1,
lastCode/0x100);
info->firstCol = font->mapping.mapping->encoding->first_col;
- info->lastCol = MIN(font->mapping.mapping->encoding->row_size-1,
+ info->lastCol = MIN(font->mapping.mapping->encoding->row_size-1,
lastCode<0x100?lastCode:0xFF);
if( info->firstRow == 0 && info->firstCol == 0 ) zero_code=0;
}
font->zero_idx = 0;
}
else
- font->zero_idx = FTRemap(face->face,
+ font->zero_idx = FTRemap(face->face,
&font->mapping, zero_code);
post = FT_Get_Sfnt_Table(face->face, ft_sfnt_post);
for (row = pinfo->firstRow; row <= pinfo->lastRow; row++) {
if ( skip_ok && tmpchar ) {
if ( !force_c_outside ) {
- if ( instance->ttcap.forceConstantSpacingBegin < row<<8
+ if ( instance->ttcap.forceConstantSpacingBegin < row<<8
&& row<<8 < (instance->ttcap.forceConstantSpacingEnd & 0x0ff00) ) {
if (tmpchar->characterWidth) {
num_chars += num_cols;
else skip_ok=0;
}
else { /* for GB18030 proportional */
- if ( instance->ttcap.forceConstantSpacingBegin < row<<8
+ if ( instance->ttcap.forceConstantSpacingBegin < row<<8
|| row<<8 < (instance->ttcap.forceConstantSpacingEnd & 0x0ff00) ) {
if (tmpchar->characterWidth) {
num_chars += num_cols;
c = row<<8|col;
flags=0;
if ( !force_c_outside ) {
- if ( c <= instance->ttcap.forceConstantSpacingEnd
+ if ( c <= instance->ttcap.forceConstantSpacingEnd
&& instance->ttcap.forceConstantSpacingBegin <= c )
flags|=FT_FORCE_CONSTANT_SPACING;
}
else { /* for GB18030 proportional */
- if ( c <= instance->ttcap.forceConstantSpacingEnd
+ if ( c <= instance->ttcap.forceConstantSpacingEnd
|| instance->ttcap.forceConstantSpacingBegin <= c )
flags|=FT_FORCE_CONSTANT_SPACING;
}
overlap = tmpchar->rightSideBearing - tmpchar->characterWidth;
if (maxOverlap < overlap)
maxOverlap = overlap;
-
+
if (!tmpchar->characterWidth)
continue;
num_chars++;
swidth += ABS(tmpchar->characterWidth);
total_width += tmpchar->characterWidth;
-
+
if ( flags & FT_FORCE_CONSTANT_SPACING ) skip_ok=1;
}
}
m.yx = vals->point_matrix[1] / base_size * 65536;
m.yy = vals->point_matrix[3] / base_size * 65536;
- return (m.xx == 65536) && (m.yx == 0) &&
+ return (m.xx == 65536) && (m.yx == 0) &&
(m.xy == 0) && (m.yy == 65536);
}
/* xf->info is only accessed through info, and xf might be null */
static int
-FreeTypeLoadXFont(char *fileName,
+FreeTypeLoadXFont(char *fileName,
FontScalablePtr vals, FontPtr xf, FontInfoPtr info,
FontBitmapFormatPtr bmfmt, FontEntryPtr entry)
{
goto quit;
}
- xrc = FreeTypeSetUpTTCap(fileName, vals,
+ xrc = FreeTypeSetUpTTCap(fileName, vals,
&dynStrRealFileName, &dynStrFTFileName,
- &tmp_ttcap, &face_number,
+ &tmp_ttcap, &face_number,
&load_flags, &ttcap_spacing,
&font_properties, &dynStrTTCapCodeRange);
if ( xrc != Successful ) {
}
xrc = FreeTypeLoadFont(font, info, face, dynStrFTFileName, vals, entry, bmfmt,
- load_flags, &tmp_ttcap, dynStrTTCapCodeRange,
+ load_flags, &tmp_ttcap, dynStrTTCapCodeRange,
ttcap_spacing );
if(xrc != Successful) {
goto quit;
width_x = max_advance_height * ins_ttcap->scaleBBoxHeight * unit_y;
}
else{
- unit_x = fabs(vals->pixel_matrix[0] -
+ unit_x = fabs(vals->pixel_matrix[0] -
vals->pixel_matrix[1]*vals->pixel_matrix[2]/vals->pixel_matrix[3]);
- unit_y = fabs(vals->pixel_matrix[2] -
+ unit_y = fabs(vals->pixel_matrix[2] -
vals->pixel_matrix[3]*vals->pixel_matrix[0]/vals->pixel_matrix[1]);
width_x = face->face->max_advance_width * ins_ttcap->scaleBBoxWidth * unit_x;
width_y = max_advance_height * ins_ttcap->scaleBBoxHeight * unit_y;
force_c_rsb += ins_ttcap->force_c_adjust_rsb_by_pixel;
force_c_lsb += ins_ttcap->force_c_adjust_lsb_by_pixel;
/* apply to rawWidth */
- averageWidth = (int)floor(10 * width_x * scale
+ averageWidth = (int)floor(10 * width_x * scale
* ratio + 0.5);
rawWidth = floor(width_x * scale
* ratio * 1000. / base_height + 0.5);
instance->forceConstantMetrics->attributes = force_c_rawWidth;
}
/* Check code 0 */
- if( FreeTypeInstanceGetGlyph(font->zero_idx, FT_FORCE_CONSTANT_SPACING,
+ if( FreeTypeInstanceGetGlyph(font->zero_idx, FT_FORCE_CONSTANT_SPACING,
&tmpglyph, font->instance) != Successful
|| tmpglyph == NULL)
if( FreeTypeInstanceGetGlyph(font->zero_idx, FT_FORCE_CONSTANT_SPACING | FT_GET_DUMMY,
if( !charcell ) { /* NOT CHARCELL */
if( info ){
- /*
+ /*
Calculate all glyphs' metrics.
maxbounds.ascent and maxbounds.descent are quite important values
- for XAA. If ascent/descent of each glyph exceeds
+ for XAA. If ascent/descent of each glyph exceeds
maxbounds.ascent/maxbounds.descent, XAA causes SERVER CRASH.
Therefore, THIS MUST BE DONE.
*/
*/
vals->width = averageWidth;
-
+
if( info ){
info->maxbounds.leftSideBearing = minLsb;
info->maxbounds.descent = descent;
info->maxbounds.attributes =
(unsigned short)(short)rawWidth;
-
+
info->minbounds = info->maxbounds;
}
}
info->fontDescent = info->maxbounds.descent;
/* Glyph metrics are accurate */
info->inkMetrics=1;
-
+
memcpy((char *)&info->ink_maxbounds,
(char *)&info->maxbounds, sizeof(xCharInfo));
memcpy((char *)&info->ink_minbounds,
(char *)&info->minbounds, sizeof(xCharInfo));
-
+
/* XXX - hack */
info->defaultCh=0;
if(xf)
xf->fontPrivate = (void*)font;
-
+
if(info) {
- xrc = FreeTypeAddProperties(font, vals, info, entry->name.name,
+ xrc = FreeTypeAddProperties(font, vals, info, entry->name.name,
rawAverageWidth, font_properties);
if (xrc != Successful) {
goto quit;
while (count-- > 0) {
switch (charEncoding) {
- case Linear8Bit:
+ case Linear8Bit:
case TwoD8Bit:
code = *chars++;
break;
- case Linear16Bit:
+ case Linear16Bit:
case TwoD16Bit:
code = (*chars++ << 8);
code |= *chars++;
/* */
if ( !(ttcap->flags & TTCAP_FORCE_C_OUTSIDE) ) {
- if ( (int)code <= ttcap->forceConstantSpacingEnd
+ if ( (int)code <= ttcap->forceConstantSpacingEnd
&& ttcap->forceConstantSpacingBegin <= (int)code )
flags|=FT_FORCE_CONSTANT_SPACING;
else flags=0;
}
else { /* for GB18030 proportional */
- if ( (int)code <= ttcap->forceConstantSpacingEnd
+ if ( (int)code <= ttcap->forceConstantSpacingEnd
|| ttcap->forceConstantSpacingBegin <= (int)code )
flags|=FT_FORCE_CONSTANT_SPACING;
else flags=0;
else *mp++ = &noSuchChar.metrics;
#endif
}
-
+
*metricCount = mp - metrics;
return Successful;
}
code = *chars++;
break;
case Linear16Bit: case TwoD16Bit:
- code = *chars++ << 8;
+ code = *chars++ << 8;
code |= *chars++;
/* */
if ( !(ttcap->flags & TTCAP_FORCE_C_OUTSIDE) ) {
- if ( (int)code <= ttcap->forceConstantSpacingEnd
+ if ( (int)code <= ttcap->forceConstantSpacingEnd
&& ttcap->forceConstantSpacingBegin <= (int)code )
flags|=FT_FORCE_CONSTANT_SPACING;
else flags=0;
}
else { /* for GB18030 proportional */
- if ( (int)code <= ttcap->forceConstantSpacingEnd
+ if ( (int)code <= ttcap->forceConstantSpacingEnd
|| ttcap->forceConstantSpacingBegin <= (int)code )
flags|=FT_FORCE_CONSTANT_SPACING;
else flags=0;
}
break;
}
-
+
if(FreeTypeFontGetGlyph(code, flags, &g, tf) == Successful && g!=NULL) {
*gp++ = g;
}
else wd=wd_actual;
if(ht_actual <= 0) ht = 1;
else ht=ht_actual;
- bpr = (((wd + (tf->instance->bmfmt.glyph<<3) - 1) >> 3) &
+ bpr = (((wd + (tf->instance->bmfmt.glyph<<3) - 1) >> 3) &
-tf->instance->bmfmt.glyph);
raster = calloc(1, ht * bpr);
if(raster) {
}
#endif
}
-
+
*glyphCount = gp - glyphs;
return Successful;
}
static int
-FreeTypeSetUpFont(FontPathElementPtr fpe, FontPtr xf, FontInfoPtr info,
+FreeTypeSetUpFont(FontPathElementPtr fpe, FontPtr xf, FontInfoPtr info,
fsBitmapFormat format, fsBitmapFormatMask fmask,
FontBitmapFormatPtr bmfmt)
{
FreeTypeGetInfoScalable, 0, CAPABILITIES},
};
-static int num_alt_renderers =
+static int num_alt_renderers =
sizeof(alt_renderers) / sizeof(alt_renderers[0]);
-
+
void
FreeTypeRegisterFontFileFunctions(void)