Skip to content

Commit

Permalink
Fix font tweaking bug
Browse files Browse the repository at this point in the history
  • Loading branch information
max_mu committed Feb 25, 2011
1 parent 78af437 commit d79e6f3
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions javacall/implementation/psp_mips/midp/ft_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ static void draw_small_bitmap(FTC_SBit bitmap, javacall_pixel color,
javacall_pixel* point = destbuf + (y + yoffset) * w + x + xoffset;

if (mode == FT_PIXEL_MODE_MONO) {
unsigned char* fontpoint = &bitmap->buffer[0] + yoffset * bitmap->width/8;
unsigned char* fontpoint = &bitmap->buffer[0] + yoffset * bitmap->pitch;

int bitOffset = xoffset%8;
int pitch = bitmap->pitch*8;
Expand All @@ -370,7 +370,7 @@ static void draw_small_bitmap(FTC_SBit bitmap, javacall_pixel color,
return; }
// Handle rendering anti-aliased bitmaps
ALPHA_BLEND_PREP
unsigned char* fontpoint = &bitmap->buffer[0] + yoffset * bitmap->width + xoffset;
unsigned char* fontpoint = &bitmap->buffer[0] + yoffset * bitmap->pitch + xoffset;

int block = xnum / 8;
int rem = xnum % 8;
Expand All @@ -395,7 +395,7 @@ static void draw_small_bitmap(FTC_SBit bitmap, javacall_pixel color,
case 1: ALPHA_BLEND }

point += (w - xnum);
fontpoint += (bitmap->width - xnum); } }
fontpoint += (bitmap->pitch - xnum); } }

// Init/check init--returns 1 only if we're good to go
int _ftc_check_init(javacall_font_face lface) {
Expand Down Expand Up @@ -470,18 +470,21 @@ javacall_result ftc_javacall_font_draw(javacall_pixel color,
unsigned int glyph_idx;
FTC_SBit irec;
FTC_ScalerRec* selected_ic;
for(i=0; i<textLen; i++) {
for(i=0; i<textLen; i++) {
glyph_idx = cmap_cache_lookup_fb(cmap_cache, &current_ic, &current_fallback_ic,
&selected_ic, text[i]);
if (FTC_SBitCache_LookupScaler(sbit_cache, selected_ic, FT_LOAD_DEFAULT,
glyph_idx, &irec, (FTC_Node*)NULL)) {
return JAVACALL_FAIL; }
return JAVACALL_FAIL;
}
draw_small_bitmap(irec, color, clipX1, clipY1, clipX2, clipY2,
destBuffer,
destBufferHoriz, destBufferVert, x,
y - irec->top + current_ic.height - 2, irec->format);
x += irec->xadvance; }
return JAVACALL_OK; }
destBuffer,
destBufferHoriz, destBufferVert, x,
y - irec->top + current_ic.height - 2, irec->format);
x += irec->xadvance;
}
return JAVACALL_OK;
}

#define _MIN_LEADING 2

Expand Down

0 comments on commit d79e6f3

Please sign in to comment.