Pārlūkot izejas kodu

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

Alex Szpakowski 11 gadi atpakaļ
vecāks
revīzija
9c747f1476

+ 0 - 32
src/modules/filesystem/physfs/Filesystem.h

@@ -197,20 +197,6 @@ public:
 	 **/
 	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.
@@ -234,24 +220,6 @@ public:
 	 **/
 	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.

+ 9 - 8
src/modules/font/freetype/TrueTypeRasterizer.cpp

@@ -34,11 +34,11 @@ TrueTypeRasterizer::TrueTypeRasterizer(FT_Library library, Data *data, int size)
 	: 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);
 
@@ -76,15 +76,16 @@ GlyphData *TrueTypeRasterizer::getGlyphData(uint32 glyph) const
 		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);