mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 20:12:43 +00:00 
			
		
		
		
	LibPDF: Tweak vertical position of truetype fonts
The vertical coordinates for truetype fonts are different somehow. We compensated a bit for that; now we compensate some more. This is still not 100% perfect, but much better than before.
This commit is contained in:
		
							parent
							
								
									b5aef8e404
								
							
						
					
					
						commit
						13f007aadb
					
				
					 2 changed files with 3 additions and 2 deletions
				
			
		|  | @ -53,7 +53,8 @@ PDFErrorOr<void> TrueTypeFont::draw_glyph(Gfx::Painter& painter, Gfx::FloatPoint | |||
|     auto style = renderer.state().paint_style; | ||||
| 
 | ||||
|     // Account for the reversed font baseline
 | ||||
|     auto position = point.translated(0, -m_font->baseline()); | ||||
|     auto position = point.translated(0, -m_font->pixel_metrics().descent - m_font->baseline()); | ||||
| 
 | ||||
|     if (style.has<Color>()) { | ||||
|         painter.draw_glyph(position, char_code, *m_font, style.get<Color>()); | ||||
|     } else { | ||||
|  |  | |||
|  | @ -71,7 +71,7 @@ PDFErrorOr<void> Type1Font::draw_glyph(Gfx::Painter& painter, Gfx::FloatPoint po | |||
| 
 | ||||
|     if (!m_font_program) { | ||||
|         // Account for the reversed font baseline
 | ||||
|         auto position = point.translated(0, -m_font->baseline()); | ||||
|         auto position = point.translated(0, -m_font->pixel_metrics().descent - m_font->baseline()); | ||||
|         // FIXME: Bounding box and sample point look to be pretty wrong
 | ||||
|         if (style.has<Color>()) { | ||||
|             painter.draw_glyph(position, char_code, *m_font, style.get<Color>()); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Nico Weber
						Nico Weber