|  | @@ -1039,6 +1039,7 @@ static FONSglyph* fons__getGlyph(FONScontext* stash, FONSfont* font, unsigned in | 
														
													
														
															
																|  |  | int pad, added; |  |  | int pad, added; | 
														
													
														
															
																|  |  | unsigned char* bdst; |  |  | unsigned char* bdst; | 
														
													
														
															
																|  |  | unsigned char* dst; |  |  | unsigned char* dst; | 
														
													
														
															
																|  |  |  |  |  | FONSfont* renderFont = font; | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | if (isize < 2) return NULL; |  |  | if (isize < 2) return NULL; | 
														
													
														
															
																|  |  | if (iblur > 20) iblur = 20; |  |  | if (iblur > 20) iblur = 20; | 
														
													
												
													
														
															
																|  | @@ -1057,18 +1058,23 @@ static FONSglyph* fons__getGlyph(FONScontext* stash, FONSfont* font, unsigned in | 
														
													
														
															
																|  |  | } |  |  | } | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | // Could not find glyph, create it. |  |  | // Could not find glyph, create it. | 
														
													
														
															
																|  |  | scale = fons__tt_getPixelHeightScale(&font->font, size); |  |  |  | 
														
													
														
															
																|  |  | g = fons__tt_getGlyphIndex(&font->font, codepoint); |  |  | g = fons__tt_getGlyphIndex(&font->font, codepoint); | 
														
													
														
															
																|  |  | // Try to find the glyph in fallback fonts. |  |  | // Try to find the glyph in fallback fonts. | 
														
													
														
															
																|  |  | if (g == 0) { |  |  | if (g == 0) { | 
														
													
														
															
																|  |  | for (i = 0; i < font->nfallbacks; ++i) { |  |  | for (i = 0; i < font->nfallbacks; ++i) { | 
														
													
														
															
																|  |  | FONSglyph* fallbackGlyph = fons__getGlyph(stash, stash->fonts[font->fallbacks[i]], codepoint, isize, iblur); |  |  |  | 
														
													
														
															
																|  |  | if (fallbackGlyph != NULL && fallbackGlyph->index != 0) { |  |  |  | 
														
													
														
															
																|  |  | return fallbackGlyph; |  |  |  | 
														
													
														
															
																|  |  |  |  |  | FONSfont* fallbackFont = stash->fonts[font->fallbacks[i]]; | 
														
													
														
															
																|  |  |  |  |  | int fallbackIndex = fons__tt_getGlyphIndex(&fallbackFont->font, codepoint); | 
														
													
														
															
																|  |  |  |  |  | if (fallbackIndex != 0) { | 
														
													
														
															
																|  |  |  |  |  | g = fallbackIndex; | 
														
													
														
															
																|  |  |  |  |  | renderFont = fallbackFont; | 
														
													
														
															
																|  |  |  |  |  | break; | 
														
													
														
															
																|  |  | } |  |  | } | 
														
													
														
															
																|  |  | } |  |  | } | 
														
													
														
															
																|  |  |  |  |  | // It is possible that we did not find a fallback glyph. | 
														
													
														
															
																|  |  |  |  |  | // In that case the glyph index 'g' is 0, and we'll proceed below and cache empty glyph. | 
														
													
														
															
																|  |  | } |  |  | } | 
														
													
														
															
																|  |  | fons__tt_buildGlyphBitmap(&font->font, g, size, scale, &advance, &lsb, &x0, &y0, &x1, &y1); |  |  |  | 
														
													
														
															
																|  |  |  |  |  | scale = fons__tt_getPixelHeightScale(&renderFont->font, size); | 
														
													
														
															
																|  |  |  |  |  | fons__tt_buildGlyphBitmap(&renderFont->font, g, size, scale, &advance, &lsb, &x0, &y0, &x1, &y1); | 
														
													
														
															
																|  |  | gw = x1-x0 + pad*2; |  |  | gw = x1-x0 + pad*2; | 
														
													
														
															
																|  |  | gh = y1-y0 + pad*2; |  |  | gh = y1-y0 + pad*2; | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
												
													
														
															
																|  | @@ -1102,7 +1108,7 @@ static FONSglyph* fons__getGlyph(FONScontext* stash, FONSfont* font, unsigned in | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | // Rasterize |  |  | // Rasterize | 
														
													
														
															
																|  |  | dst = &stash->texData[(glyph->x0+pad) + (glyph->y0+pad) * stash->params.width]; |  |  | dst = &stash->texData[(glyph->x0+pad) + (glyph->y0+pad) * stash->params.width]; | 
														
													
														
															
																|  |  | fons__tt_renderGlyphBitmap(&font->font, dst, gw-pad*2,gh-pad*2, stash->params.width, scale,scale, g); |  |  |  | 
														
													
														
															
																|  |  |  |  |  | fons__tt_renderGlyphBitmap(&renderFont->font, dst, gw-pad*2,gh-pad*2, stash->params.width, scale,scale, g); | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | // Make sure there is one pixel empty border. |  |  | // Make sure there is one pixel empty border. | 
														
													
														
															
																|  |  | dst = &stash->texData[glyph->x0 + glyph->y0 * stash->params.width]; |  |  | dst = &stash->texData[glyph->x0 + glyph->y0 * stash->params.width]; | 
														
													
												
													
														
															
																|  | 
 |