Commits

Alex Szpakowski committed 3d34de7

Switched to using bearing and advance metrics from the actual bitmap glyph object, removed old unused method declarations in the Filesystem class.

Comments (0)

Files changed (2)

src/modules/filesystem/physfs/Filesystem.h

 	bool remove(const char *file);
 
 	/**
-	 * Opens a file for reading or writing. (Depends
-	 * on the mode chosen at the time of creation).
-	 * @param file The file to open.
-	 * @param mode The mode to open the file in.
-	 **/
-	bool open(File *file, File::Mode mode);
-
-	/**
-	 * Closes a file.
-	 * @param file The file to close.
-	 **/
-	bool close(File *file);
-
-	/**
 	 * Reads data from a file.
 	 * @param filename The name of the file to read from.
 	 * @param size The size in bytes of the data to read.
 	void append(const char *filename, const void *data, int64 size) const;
 
 	/**
-	 * Check if end-of-file is reached.
-	 * @return True if EOF, false otherwise.
-	 **/
-	bool eof(File *file);
-
-	/**
-	 * Gets the current position in a file.
-	 * @param file An open File.
-	 **/
-	int tell(File *file);
-
-	/**
-	 * Seek to a position within a file.
-	 * @param pos The position to seek to.
-	 **/
-	bool seek(File *file, uint64 pos);
-
-	/**
 	 * This "native" method returns a table of all
 	 * files in a given directory.
 	 **/

src/modules/font/freetype/TrueTypeRasterizer.cpp

 	: data(data)
 {
 	if (FT_New_Memory_Face(library,
-						  (const FT_Byte *)data->getData(),	/* first byte in memory */
-						  data->getSize(),					/* size in bytes        */
-						  0,									/* face_index           */
-						  &face))
-		throw love::Exception("TrueTypeFont Loading error: FT_New_Face failed (there is probably a problem with your font file)\n");
+	                      (const FT_Byte *)data->getData(), /* first byte in memory */
+	                      data->getSize(),                  /* size in bytes        */
+	                      0,                                /* face_index           */
+	                      &face))
+		throw love::Exception("TrueTypeFont Loading error: FT_New_Face failed (there is probably a problem with your font file)");
 
 	FT_Set_Pixel_Sizes(face, size, size);
 
 		throw love::Exception("TrueTypeFont Loading error: FT_Get_Glyph failed");
 
 	FT_Glyph_To_Bitmap(&ftglyph, FT_RENDER_MODE_NORMAL, 0, 1);
+
 	FT_BitmapGlyph bitmap_glyph = (FT_BitmapGlyph) ftglyph;
 	FT_Bitmap &bitmap = bitmap_glyph->bitmap; //just to make things easier
 
 	// Get metrics
-	glyphMetrics.bearingX = face->glyph->metrics.horiBearingX >> 6;
-	glyphMetrics.bearingY = face->glyph->metrics.horiBearingY >> 6;
+	glyphMetrics.bearingX = bitmap_glyph->left;
+	glyphMetrics.bearingY = bitmap_glyph->top;
 	glyphMetrics.height = bitmap.rows;
 	glyphMetrics.width = bitmap.width;
-	glyphMetrics.advance = face->glyph->metrics.horiAdvance >> 6;
+	glyphMetrics.advance = ftglyph->advance.x >> 16;
 
 	GlyphData *glyphData = new GlyphData(glyph, glyphMetrics, GlyphData::FORMAT_LUMINANCE_ALPHA);