Commits

Bart van Strien committed e0b5c2e Merge

Merge in minor branch, now minor is our next development target

Comments (0)

Files changed (89)

platform/macosx/love.xcodeproj/project.pbxproj

 		A93E6E5410420B57007D418B /* SDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A93E6E5210420B57007D418B /* SDL.framework */; };
 		A93E6E5510420B57007D418B /* Lua.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A93E6E5310420B57007D418B /* Lua.framework */; };
 		A93E6EED10420BA8007D418B /* love.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E6A3410420AC0007D418B /* love.cpp */; };
-		A946CE821172BCD7005E1462 /* wrap_EncodedImageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A946CE811172BCD7005E1462 /* wrap_EncodedImageData.cpp */; };
-		A946D3BB117681BD005E1462 /* FontData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A946D3BA117681BC005E1462 /* FontData.cpp */; };
-		A946D3C611768D69005E1462 /* wrap_FontData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A946D3C511768D69005E1462 /* wrap_FontData.cpp */; };
 		A946D67F104248DA002BF36C /* Reference.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E69EA10420ABF007D418B /* Reference.cpp */; };
 		A946D680104248DA002BF36C /* Matrix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E69E310420ABF007D418B /* Matrix.cpp */; };
 		A946D681104248DA002BF36C /* Object.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E69E810420ABF007D418B /* Object.cpp */; };
 		A946D682104248DA002BF36C /* Vector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E69EF10420ABF007D418B /* Vector.cpp */; };
-		A946D683104248DA002BF36C /* MemoryData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E69E510420ABF007D418B /* MemoryData.cpp */; };
 		A946D684104248DA002BF36C /* wrap_Data.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E69F210420ABF007D418B /* wrap_Data.cpp */; };
 		A946D685104248DA002BF36C /* runtime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E69EC10420ABF007D418B /* runtime.cpp */; };
 		A946D686104248DA002BF36C /* Exception.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E69E010420ABF007D418B /* Exception.cpp */; };
 		A946D702104249A4002BF36C /* Graphics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E6A8D10420AC2007D418B /* Graphics.cpp */; };
 		A946D703104249A4002BF36C /* Font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E6A8710420AC2007D418B /* Font.cpp */; };
 		A946D704104249A4002BF36C /* SpriteBatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E6A9510420AC2007D418B /* SpriteBatch.cpp */; };
-		A946D705104249A4002BF36C /* wrap_Glyph.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E6A9B10420AC2007D418B /* wrap_Glyph.cpp */; };
-		A946D706104249A4002BF36C /* Glyph.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E6A8B10420AC2007D418B /* Glyph.cpp */; };
 		A946D708104249A4002BF36C /* Drawable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E6A8210420AC2007D418B /* Drawable.cpp */; };
 		A946D709104249A4002BF36C /* wrap_Graphics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E6A9D10420AC3007D418B /* wrap_Graphics.cpp */; };
 		A946D70A104249A4002BF36C /* Image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E6A8F10420AC2007D418B /* Image.cpp */; };
 		A968F0DE1083AA6600A895AA /* Joint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A968F0DC1083AA6600A895AA /* Joint.cpp */; };
 		A986DEB5113249A800810279 /* Thread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A986DEB1113249A800810279 /* Thread.cpp */; };
 		A986DEB6113249A800810279 /* wrap_Thread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A986DEB3113249A800810279 /* wrap_Thread.cpp */; };
-		A98D914410507C97008E03F2 /* EncodedImageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A98D914310507C97008E03F2 /* EncodedImageData.cpp */; };
 		A9B4BA9C1045937F001DBC80 /* ParticleSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9B4BA9A1045937F001DBC80 /* ParticleSystem.cpp */; };
 		A9B4BA9D1045937F001DBC80 /* wrap_ParticleSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9B4BA9B1045937F001DBC80 /* wrap_ParticleSystem.cpp */; };
 		A9BD60741226C988007DEC63 /* Framebuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9BD60701226C988007DEC63 /* Framebuffer.cpp */; };
 		A93E69E210420ABF007D418B /* math.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = math.h; sourceTree = "<group>"; };
 		A93E69E310420ABF007D418B /* Matrix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Matrix.cpp; sourceTree = "<group>"; };
 		A93E69E410420ABF007D418B /* Matrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Matrix.h; sourceTree = "<group>"; };
-		A93E69E510420ABF007D418B /* MemoryData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryData.cpp; sourceTree = "<group>"; };
-		A93E69E610420ABF007D418B /* MemoryData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryData.h; sourceTree = "<group>"; };
 		A93E69E710420ABF007D418B /* Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Module.h; sourceTree = "<group>"; };
 		A93E69E810420ABF007D418B /* Object.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Object.cpp; sourceTree = "<group>"; };
 		A93E69E910420ABF007D418B /* Object.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Object.h; sourceTree = "<group>"; };
 		A93E6A8810420AC2007D418B /* Font.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Font.h; sourceTree = "<group>"; };
 		A93E6A8910420AC2007D418B /* GLee.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = GLee.c; sourceTree = "<group>"; };
 		A93E6A8A10420AC2007D418B /* GLee.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLee.h; sourceTree = "<group>"; };
-		A93E6A8B10420AC2007D418B /* Glyph.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Glyph.cpp; sourceTree = "<group>"; };
-		A93E6A8C10420AC2007D418B /* Glyph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Glyph.h; sourceTree = "<group>"; };
 		A93E6A8D10420AC2007D418B /* Graphics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Graphics.cpp; sourceTree = "<group>"; };
 		A93E6A8E10420AC2007D418B /* Graphics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Graphics.h; sourceTree = "<group>"; };
 		A93E6A8F10420AC2007D418B /* Image.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Image.cpp; sourceTree = "<group>"; };
 		A93E6A9610420AC2007D418B /* SpriteBatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpriteBatch.h; sourceTree = "<group>"; };
 		A93E6A9910420AC2007D418B /* wrap_Font.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Font.cpp; sourceTree = "<group>"; };
 		A93E6A9A10420AC2007D418B /* wrap_Font.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Font.h; sourceTree = "<group>"; };
-		A93E6A9B10420AC2007D418B /* wrap_Glyph.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Glyph.cpp; sourceTree = "<group>"; };
-		A93E6A9C10420AC2007D418B /* wrap_Glyph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Glyph.h; sourceTree = "<group>"; };
 		A93E6A9D10420AC3007D418B /* wrap_Graphics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Graphics.cpp; sourceTree = "<group>"; };
 		A93E6A9E10420AC3007D418B /* wrap_Graphics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Graphics.h; sourceTree = "<group>"; };
 		A93E6A9F10420AC3007D418B /* wrap_Image.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Image.cpp; sourceTree = "<group>"; };
 		A93E6E4810420B4A007D418B /* FreeType.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FreeType.framework; path = /Library/Frameworks/FreeType.framework; sourceTree = "<absolute>"; };
 		A93E6E5210420B57007D418B /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = /Library/Frameworks/SDL.framework; sourceTree = "<absolute>"; };
 		A93E6E5310420B57007D418B /* Lua.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Lua.framework; path = /Library/Frameworks/Lua.framework; sourceTree = "<absolute>"; };
-		A946CE801172BCD6005E1462 /* wrap_EncodedImageData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_EncodedImageData.h; sourceTree = "<group>"; };
-		A946CE811172BCD7005E1462 /* wrap_EncodedImageData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_EncodedImageData.cpp; sourceTree = "<group>"; };
-		A946D3B9117681BC005E1462 /* FontData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontData.h; sourceTree = "<group>"; };
-		A946D3BA117681BC005E1462 /* FontData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontData.cpp; sourceTree = "<group>"; };
-		A946D3C411768D69005E1462 /* wrap_FontData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_FontData.h; sourceTree = "<group>"; };
-		A946D3C511768D69005E1462 /* wrap_FontData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_FontData.cpp; sourceTree = "<group>"; };
+		A944D58C13244E5D0039937C /* checked.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = checked.h; sourceTree = "<group>"; };
+		A944D58D13244E5D0039937C /* core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = core.h; sourceTree = "<group>"; };
+		A944D58E13244E5D0039937C /* unchecked.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unchecked.h; sourceTree = "<group>"; };
+		A944D58F13244E5D0039937C /* utf8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utf8.h; sourceTree = "<group>"; };
 		A946D4421176AC42005E1462 /* Font.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Font.h; sourceTree = "<group>"; };
 		A95684F5125D3555001B276B /* b64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b64.cpp; sourceTree = "<group>"; };
 		A95684F6125D3555001B276B /* b64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b64.h; sourceTree = "<group>"; };
 		A986DEB2113249A800810279 /* Thread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Thread.h; sourceTree = "<group>"; };
 		A986DEB3113249A800810279 /* wrap_Thread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Thread.cpp; sourceTree = "<group>"; };
 		A986DEB4113249A800810279 /* wrap_Thread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Thread.h; sourceTree = "<group>"; };
-		A98D913E10507BF9008E03F2 /* EncodedImageData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EncodedImageData.h; sourceTree = "<group>"; };
-		A98D914310507C97008E03F2 /* EncodedImageData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EncodedImageData.cpp; sourceTree = "<group>"; };
 		A9B1AE451197293000D496EB /* love_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = love_Prefix.pch; sourceTree = "<group>"; };
 		A9B4BA981045937F001DBC80 /* ParticleSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParticleSystem.h; sourceTree = "<group>"; };
 		A9B4BA991045937F001DBC80 /* wrap_ParticleSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_ParticleSystem.h; sourceTree = "<group>"; };
 				A93E69E210420ABF007D418B /* math.h */,
 				A93E69E310420ABF007D418B /* Matrix.cpp */,
 				A93E69E410420ABF007D418B /* Matrix.h */,
-				A93E69E510420ABF007D418B /* MemoryData.cpp */,
-				A93E69E610420ABF007D418B /* MemoryData.h */,
 				A93E69E710420ABF007D418B /* Module.h */,
 				A93E69E810420ABF007D418B /* Object.cpp */,
 				A93E69E910420ABF007D418B /* Object.h */,
 			isa = PBXGroup;
 			children = (
 				A93E6A0210420ABF007D418B /* luasocket */,
+				A944D58A13244E5D0039937C /* utf8 */,
 			);
 			path = libraries;
 			sourceTree = "<group>";
 			isa = PBXGroup;
 			children = (
 				A946D4421176AC42005E1462 /* Font.h */,
-				A946D3BA117681BC005E1462 /* FontData.cpp */,
-				A946D3B9117681BC005E1462 /* FontData.h */,
 				A93E6A7010420AC1007D418B /* freetype */,
 				A93E6A7710420AC2007D418B /* GlyphData.cpp */,
 				A93E6A7810420AC2007D418B /* GlyphData.h */,
 				A93E6A7A10420AC2007D418B /* ImageRasterizer.h */,
 				A93E6A7B10420AC2007D418B /* Rasterizer.cpp */,
 				A93E6A7C10420AC2007D418B /* Rasterizer.h */,
-				A946D3C511768D69005E1462 /* wrap_FontData.cpp */,
-				A946D3C411768D69005E1462 /* wrap_FontData.h */,
 				A93E6A7D10420AC2007D418B /* wrap_GlyphData.cpp */,
 				A93E6A7E10420AC2007D418B /* wrap_GlyphData.h */,
 				A93E6A7F10420AC2007D418B /* wrap_Rasterizer.cpp */,
 				A9BD60711226C988007DEC63 /* Framebuffer.h */,
 				A93E6A8910420AC2007D418B /* GLee.c */,
 				A93E6A8A10420AC2007D418B /* GLee.h */,
-				A93E6A8B10420AC2007D418B /* Glyph.cpp */,
-				A93E6A8C10420AC2007D418B /* Glyph.h */,
 				A93E6A8D10420AC2007D418B /* Graphics.cpp */,
 				A93E6A8E10420AC2007D418B /* Graphics.h */,
 				A93E6A8F10420AC2007D418B /* Image.cpp */,
 				A93E6A9A10420AC2007D418B /* wrap_Font.h */,
 				A9BD60721226C988007DEC63 /* wrap_Framebuffer.cpp */,
 				A9BD60731226C988007DEC63 /* wrap_Framebuffer.h */,
-				A93E6A9B10420AC2007D418B /* wrap_Glyph.cpp */,
-				A93E6A9C10420AC2007D418B /* wrap_Glyph.h */,
 				A93E6A9D10420AC3007D418B /* wrap_Graphics.cpp */,
 				A93E6A9E10420AC3007D418B /* wrap_Graphics.h */,
 				A93E6A9F10420AC3007D418B /* wrap_Image.cpp */,
 			isa = PBXGroup;
 			children = (
 				A93E6AA810420AC3007D418B /* devil */,
-				A98D914310507C97008E03F2 /* EncodedImageData.cpp */,
-				A98D913E10507BF9008E03F2 /* EncodedImageData.h */,
 				A93E6AAD10420AC3007D418B /* Image.h */,
 				A93E6AAE10420AC3007D418B /* ImageData.cpp */,
 				A93E6AAF10420AC3007D418B /* ImageData.h */,
-				A946CE811172BCD7005E1462 /* wrap_EncodedImageData.cpp */,
-				A946CE801172BCD6005E1462 /* wrap_EncodedImageData.h */,
 				A93E6AB010420AC3007D418B /* wrap_Image.cpp */,
 				A93E6AB110420AC3007D418B /* wrap_Image.h */,
 				A93E6AB210420AC3007D418B /* wrap_ImageData.cpp */,
 			path = scripts;
 			sourceTree = "<group>";
 		};
+		A944D58A13244E5D0039937C /* utf8 */ = {
+			isa = PBXGroup;
+			children = (
+				A944D58B13244E5D0039937C /* utf8 */,
+				A944D58F13244E5D0039937C /* utf8.h */,
+			);
+			path = utf8;
+			sourceTree = "<group>";
+		};
+		A944D58B13244E5D0039937C /* utf8 */ = {
+			isa = PBXGroup;
+			children = (
+				A944D58C13244E5D0039937C /* checked.h */,
+				A944D58D13244E5D0039937C /* core.h */,
+				A944D58E13244E5D0039937C /* unchecked.h */,
+			);
+			path = utf8;
+			sourceTree = "<group>";
+		};
 		A986DEAF113249A700810279 /* thread */ = {
 			isa = PBXGroup;
 			children = (
 				A946D680104248DA002BF36C /* Matrix.cpp in Sources */,
 				A946D681104248DA002BF36C /* Object.cpp in Sources */,
 				A946D682104248DA002BF36C /* Vector.cpp in Sources */,
-				A946D683104248DA002BF36C /* MemoryData.cpp in Sources */,
 				A946D684104248DA002BF36C /* wrap_Data.cpp in Sources */,
 				A946D685104248DA002BF36C /* runtime.cpp in Sources */,
 				A946D686104248DA002BF36C /* Exception.cpp in Sources */,
 				A946D702104249A4002BF36C /* Graphics.cpp in Sources */,
 				A946D703104249A4002BF36C /* Font.cpp in Sources */,
 				A946D704104249A4002BF36C /* SpriteBatch.cpp in Sources */,
-				A946D705104249A4002BF36C /* wrap_Glyph.cpp in Sources */,
-				A946D706104249A4002BF36C /* Glyph.cpp in Sources */,
 				A946D708104249A4002BF36C /* Drawable.cpp in Sources */,
 				A946D709104249A4002BF36C /* wrap_Graphics.cpp in Sources */,
 				A946D70A104249A4002BF36C /* Image.cpp in Sources */,
 				A9255DEC1043188D00BA1496 /* SDLMain.m in Sources */,
 				A9B4BA9C1045937F001DBC80 /* ParticleSystem.cpp in Sources */,
 				A9B4BA9D1045937F001DBC80 /* wrap_ParticleSystem.cpp in Sources */,
-				A98D914410507C97008E03F2 /* EncodedImageData.cpp in Sources */,
 				A968F0CF1083A9A900A895AA /* Event.cpp in Sources */,
 				A968F0D11083A9B900A895AA /* File.cpp in Sources */,
 				A968F0D31083A9D400A895AA /* Graphics.cpp in Sources */,
 				A93A3AB51121E86E003B04A4 /* Image.cpp in Sources */,
 				A986DEB5113249A800810279 /* Thread.cpp in Sources */,
 				A986DEB6113249A800810279 /* wrap_Thread.cpp in Sources */,
-				A946CE821172BCD7005E1462 /* wrap_EncodedImageData.cpp in Sources */,
-				A946D3BB117681BD005E1462 /* FontData.cpp in Sources */,
-				A946D3C611768D69005E1462 /* wrap_FontData.cpp in Sources */,
 				A9BD60741226C988007DEC63 /* Framebuffer.cpp in Sources */,
 				A9BD60751226C988007DEC63 /* wrap_Framebuffer.cpp in Sources */,
 				A95684F7125D3555001B276B /* b64.cpp in Sources */,
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				HEADER_SEARCH_PATHS = (
 					/Library/Frameworks/Lua.framework/Headers,
+					/Library/Frameworks/FreeType.framework/Headers,
 					/Library/Frameworks/SDL.framework/Headers,
 					../../src,
 					../../src/modules,

platform/msvc2010/love.vcxproj

     <ClCompile Include="..\..\src\modules\filesystem\physfs\wrap_File.cpp" />
     <ClCompile Include="..\..\src\modules\filesystem\physfs\wrap_FileData.cpp" />
     <ClCompile Include="..\..\src\modules\filesystem\physfs\wrap_Filesystem.cpp" />
-    <ClCompile Include="..\..\src\modules\font\FontData.cpp" />
     <ClCompile Include="..\..\src\modules\font\freetype\Font.cpp" />
     <ClCompile Include="..\..\src\modules\font\freetype\TrueTypeRasterizer.cpp" />
     <ClCompile Include="..\..\src\modules\font\freetype\wrap_Font.cpp" />
     <ClCompile Include="..\..\src\modules\font\GlyphData.cpp" />
     <ClCompile Include="..\..\src\modules\font\ImageRasterizer.cpp" />
     <ClCompile Include="..\..\src\modules\font\Rasterizer.cpp" />
-    <ClCompile Include="..\..\src\modules\font\wrap_FontData.cpp" />
     <ClCompile Include="..\..\src\modules\font\wrap_GlyphData.cpp" />
     <ClCompile Include="..\..\src\modules\font\wrap_Rasterizer.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\Drawable.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\GLee.c">
       <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel>
     </ClCompile>
-    <ClCompile Include="..\..\src\modules\graphics\opengl\Glyph.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\Graphics.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\Image.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\ParticleSystem.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\SpriteBatch.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Font.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Framebuffer.cpp" />
-    <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Glyph.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Graphics.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Image.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_ParticleSystem.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\Volatile.cpp" />
     <ClCompile Include="..\..\src\modules\image\devil\Image.cpp" />
     <ClCompile Include="..\..\src\modules\image\devil\ImageData.cpp" />
-    <ClCompile Include="..\..\src\modules\image\EncodedImageData.cpp" />
     <ClCompile Include="..\..\src\modules\image\ImageData.cpp" />
-    <ClCompile Include="..\..\src\modules\image\wrap_EncodedImageData.cpp" />
     <ClCompile Include="..\..\src\modules\image\wrap_Image.cpp" />
     <ClCompile Include="..\..\src\modules\image\wrap_ImageData.cpp" />
     <ClCompile Include="..\..\src\modules\joystick\Joystick.cpp" />
     <ClInclude Include="..\..\src\common\version.h" />
     <ClInclude Include="..\..\src\common\wrap_Data.h" />
     <ClInclude Include="..\..\src\libraries\luasocket\luasocket.h" />
+    <ClInclude Include="..\..\src\libraries\utf8\utf8.h" />
+    <ClInclude Include="..\..\src\libraries\utf8\utf8\checked.h" />
+    <ClInclude Include="..\..\src\libraries\utf8\utf8\core.h" />
+    <ClInclude Include="..\..\src\libraries\utf8\utf8\unchecked.h" />
     <ClInclude Include="..\..\src\modules\audio\Audio.h" />
     <ClInclude Include="..\..\src\modules\audio\null\Audio.h" />
     <ClInclude Include="..\..\src\modules\audio\null\Source.h" />
     <ClInclude Include="..\..\src\modules\filesystem\physfs\wrap_FileData.h" />
     <ClInclude Include="..\..\src\modules\filesystem\physfs\wrap_Filesystem.h" />
     <ClInclude Include="..\..\src\modules\font\Font.h" />
-    <ClInclude Include="..\..\src\modules\font\FontData.h" />
     <ClInclude Include="..\..\src\modules\font\freetype\Font.h" />
     <ClInclude Include="..\..\src\modules\font\freetype\TrueTypeRasterizer.h" />
     <ClInclude Include="..\..\src\modules\font\freetype\wrap_Font.h" />
     <ClInclude Include="..\..\src\modules\font\GlyphData.h" />
     <ClInclude Include="..\..\src\modules\font\ImageRasterizer.h" />
     <ClInclude Include="..\..\src\modules\font\Rasterizer.h" />
-    <ClInclude Include="..\..\src\modules\font\wrap_FontData.h" />
     <ClInclude Include="..\..\src\modules\font\wrap_GlyphData.h" />
     <ClInclude Include="..\..\src\modules\font\wrap_Rasterizer.h" />
     <ClInclude Include="..\..\src\modules\graphics\Drawable.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\Font.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\Framebuffer.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\GLee.h" />
-    <ClInclude Include="..\..\src\modules\graphics\opengl\Glyph.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\Graphics.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\Image.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\ParticleSystem.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\SpriteBatch.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Font.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Framebuffer.h" />
-    <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Glyph.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Graphics.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Image.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_ParticleSystem.h" />
     <ClInclude Include="..\..\src\modules\graphics\Volatile.h" />
     <ClInclude Include="..\..\src\modules\image\devil\Image.h" />
     <ClInclude Include="..\..\src\modules\image\devil\ImageData.h" />
-    <ClInclude Include="..\..\src\modules\image\EncodedImageData.h" />
     <ClInclude Include="..\..\src\modules\image\Image.h" />
     <ClInclude Include="..\..\src\modules\image\ImageData.h" />
-    <ClInclude Include="..\..\src\modules\image\wrap_EncodedImageData.h" />
     <ClInclude Include="..\..\src\modules\image\wrap_Image.h" />
     <ClInclude Include="..\..\src\modules\image\wrap_ImageData.h" />
     <ClInclude Include="..\..\src\modules\joystick\Joystick.h" />

platform/msvc2010/love.vcxproj.filters

     <Filter Include="common">
       <UniqueIdentifier>{f4054111-5d0f-40d9-90a9-da5da444bc50}</UniqueIdentifier>
     </Filter>
+    <Filter Include="utf8">
+      <UniqueIdentifier>{1aa85882-2a85-47c7-8d4b-19b41feb6b82}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="utf8\utf8">
+      <UniqueIdentifier>{014c1d0d-8028-42fc-a870-19f78d93b083}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\src\love.cpp" />
     <ClCompile Include="..\..\src\modules\filesystem\physfs\wrap_Filesystem.cpp">
       <Filter>modules\filesystem\physfs</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\src\modules\font\FontData.cpp">
-      <Filter>modules\font</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\modules\font\GlyphData.cpp">
       <Filter>modules\font</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\font\Rasterizer.cpp">
       <Filter>modules\font</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\src\modules\font\wrap_FontData.cpp">
-      <Filter>modules\font</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\modules\font\wrap_GlyphData.cpp">
       <Filter>modules\font</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\graphics\opengl\GLee.c">
       <Filter>modules\graphics\opengl</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\src\modules\graphics\opengl\Glyph.cpp">
-      <Filter>modules\graphics\opengl</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\modules\graphics\opengl\Graphics.cpp">
       <Filter>modules\graphics\opengl</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Font.cpp">
       <Filter>modules\graphics\opengl</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Glyph.cpp">
-      <Filter>modules\graphics\opengl</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Graphics.cpp">
       <Filter>modules\graphics\opengl</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_SpriteBatch.cpp">
       <Filter>modules\graphics\opengl</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\src\modules\image\EncodedImageData.cpp">
-      <Filter>modules\image</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\modules\image\ImageData.cpp">
       <Filter>modules\image</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\src\modules\image\wrap_EncodedImageData.cpp">
-      <Filter>modules\image</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\modules\image\wrap_Image.cpp">
       <Filter>modules\image</Filter>
     </ClCompile>
     <ClInclude Include="..\..\src\modules\font\Font.h">
       <Filter>modules\font</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\src\modules\font\FontData.h">
-      <Filter>modules\font</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\src\modules\font\GlyphData.h">
       <Filter>modules\font</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\font\Rasterizer.h">
       <Filter>modules\font</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\src\modules\font\wrap_FontData.h">
-      <Filter>modules\font</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\src\modules\font\wrap_GlyphData.h">
       <Filter>modules\font</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\graphics\opengl\GLee.h">
       <Filter>modules\graphics\opengl</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\src\modules\graphics\opengl\Glyph.h">
-      <Filter>modules\graphics\opengl</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\src\modules\graphics\opengl\Graphics.h">
       <Filter>modules\graphics\opengl</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Font.h">
       <Filter>modules\graphics\opengl</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Glyph.h">
-      <Filter>modules\graphics\opengl</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Graphics.h">
       <Filter>modules\graphics\opengl</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_SpriteBatch.h">
       <Filter>modules\graphics\opengl</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\src\modules\image\EncodedImageData.h">
-      <Filter>modules\image</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\src\modules\image\Image.h">
       <Filter>modules\image</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\image\ImageData.h">
       <Filter>modules\image</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\src\modules\image\wrap_EncodedImageData.h">
-      <Filter>modules\image</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\src\modules\image\wrap_Image.h">
       <Filter>modules\image</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Framebuffer.h">
       <Filter>modules\graphics\opengl</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\libraries\utf8\utf8.h">
+      <Filter>utf8</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\libraries\utf8\utf8\checked.h">
+      <Filter>utf8\utf8</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\libraries\utf8\utf8\core.h">
+      <Filter>utf8\utf8</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\libraries\utf8\utf8\unchecked.h">
+      <Filter>utf8\utf8</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="app.rc" />

src/common/MemoryData.cpp

-/**
-* Copyright (c) 2006-2011 LOVE Development Team
-* 
-* This software is provided 'as-is', without any express or implied
-* warranty.  In no event will the authors be held liable for any damages
-* arising from the use of this software.
-* 
-* Permission is granted to anyone to use this software for any purpose,
-* including commercial applications, and to alter it and redistribute it
-* freely, subject to the following restrictions:
-* 
-* 1. The origin of this software must not be misrepresented; you must not
-*    claim that you wrote the original software. If you use this software
-*    in a product, an acknowledgment in the product documentation would be
-*    appreciated but is not required.
-* 2. Altered source versions must be plainly marked as such, and must not be
-*    misrepresented as being the original software.
-* 3. This notice may not be removed or altered from any source distribution.
-**/
-
-// LOVE
-#include "MemoryData.h"
-
-namespace love
-{	
-	MemoryData::MemoryData(void * data, int size)
-		: data(data), size(size)
-	{
-	}
-
-	MemoryData::~MemoryData()
-	{
-		// Memory should be static.
-	}
-
-	void * MemoryData::getData() const
-	{
-		return data;
-	}
-
-	int MemoryData::getSize() const
-	{
-		return size;
-	}
-
-} // love

src/common/MemoryData.h

-/**
-* Copyright (c) 2006-2011 LOVE Development Team
-* 
-* This software is provided 'as-is', without any express or implied
-* warranty.  In no event will the authors be held liable for any damages
-* arising from the use of this software.
-* 
-* Permission is granted to anyone to use this software for any purpose,
-* including commercial applications, and to alter it and redistribute it
-* freely, subject to the following restrictions:
-* 
-* 1. The origin of this software must not be misrepresented; you must not
-*    claim that you wrote the original software. If you use this software
-*    in a product, an acknowledgment in the product documentation would be
-*    appreciated but is not required.
-* 2. Altered source versions must be plainly marked as such, and must not be
-*    misrepresented as being the original software.
-* 3. This notice may not be removed or altered from any source distribution.
-**/
-
-#ifndef LOVE_MEMORY_DATA_H
-#define LOVE_MEMORY_DATA_H
-
-// LOVE
-#include "Data.h"
-
-namespace love
-{	
-	/**
-	* Allows files to be embedded into LOVE and used in Lua. This
-	* class assumes the referenced memory area is static, which means
-	* it will not attempt to delete the memory.
-	**/
-	class MemoryData : public Data
-	{
-	private:
-
-		/**
-		* Pointer to the memory area.
-		**/
-		void * data;
-
-		/**
-		* Size of the memory pointed to.
-		**/
-		int size; 
-
-	public:
-
-		/**
-		* Creates a new MemoryData.
-		* @param data Pointer to the static memory. 
-		* @param size Size of the memory data.
-		**/
-		MemoryData(void * data, int size);
-
-		/**
-		* Destructor. Does NOTHING.
-		**/
-		virtual ~MemoryData();
-
-		// Implements Data.
-		void * getData() const;
-		int getSize() const;
-
-	}; // MemoryData
-} // love
-
-#endif // LOVE_MEMORY_DATA_H

src/common/config.h

 #if defined(LOVE_WINDOWS)
 #	define LOVE_LEGENDARY_UTF8_ARGV_HACK
 #	define LOVE_LEGENDARY_CONSOLE_IO_HACK
+#	define NOMINMAX
 #endif
 
 #endif // LOVE_CONFIG_H

src/common/runtime.cpp

 
 		// Image
 		{"ImageData", IMAGE_IMAGE_DATA_ID},
-		{"EncodedImageData", IMAGE_ENCODED_IMAGE_DATA_ID},
 
 		// Audio
 		{"Source", AUDIO_SOURCE_ID},

src/libraries/utf8/utf8.h

+// Copyright 2006 Nemanja Trifunovic
+
+/*
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+
+#ifndef UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731
+#define UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731
+
+#include "utf8/checked.h"
+#include "utf8/unchecked.h"
+
+#endif // header guard

src/libraries/utf8/utf8/checked.h

+// Copyright 2006 Nemanja Trifunovic
+
+/*
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+
+#ifndef UTF8_FOR_CPP_CHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731
+#define UTF8_FOR_CPP_CHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731
+
+#include "core.h"
+#include <stdexcept>
+
+namespace utf8
+{
+    // Base for the exceptions that may be thrown from the library
+    class exception : public std::exception {
+    };
+
+    // Exceptions that may be thrown from the library functions.
+    class invalid_code_point : public exception {
+        uint32_t cp;
+    public:
+        invalid_code_point(uint32_t cp) : cp(cp) {}
+        virtual const char* what() const throw() { return "Invalid code point"; }
+        uint32_t code_point() const {return cp;}
+    };
+
+    class invalid_utf8 : public exception {
+        uint8_t u8;
+    public:
+        invalid_utf8 (uint8_t u) : u8(u) {}
+        virtual const char* what() const throw() { return "Invalid UTF-8"; }
+        uint8_t utf8_octet() const {return u8;}
+    };
+
+    class invalid_utf16 : public exception {
+        uint16_t u16;
+    public:
+        invalid_utf16 (uint16_t u) : u16(u) {}
+        virtual const char* what() const throw() { return "Invalid UTF-16"; }
+        uint16_t utf16_word() const {return u16;}
+    };
+
+    class not_enough_room : public exception {
+    public:
+        virtual const char* what() const throw() { return "Not enough space"; }
+    };
+
+    /// The library API - functions intended to be called by the users
+
+    template <typename octet_iterator, typename output_iterator>
+    output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out, uint32_t replacement)
+    {
+        while (start != end) {
+            octet_iterator sequence_start = start;
+            internal::utf_error err_code = internal::validate_next(start, end);
+            switch (err_code) {
+                case internal::UTF8_OK :
+                    for (octet_iterator it = sequence_start; it != start; ++it)
+                        *out++ = *it;
+                    break;
+                case internal::NOT_ENOUGH_ROOM:
+                    throw not_enough_room();
+                case internal::INVALID_LEAD:
+                    append (replacement, out);
+                    ++start;
+                    break;
+                case internal::INCOMPLETE_SEQUENCE:
+                case internal::OVERLONG_SEQUENCE:
+                case internal::INVALID_CODE_POINT:
+                    append (replacement, out);
+                    ++start;
+                    // just one replacement mark for the sequence
+                    while (internal::is_trail(*start) && start != end)
+                        ++start;
+                    break;
+            }
+        }
+        return out;
+    }
+
+    template <typename octet_iterator, typename output_iterator>
+    inline output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out)
+    {
+        static const uint32_t replacement_marker = internal::mask16(0xfffd);
+        return replace_invalid(start, end, out, replacement_marker);
+    }
+
+    template <typename octet_iterator>
+    octet_iterator append(uint32_t cp, octet_iterator result)
+    {
+        if (!internal::is_code_point_valid(cp))
+            throw invalid_code_point(cp);
+
+        if (cp < 0x80)                        // one octet
+            *(result++) = static_cast<uint8_t>(cp);
+        else if (cp < 0x800) {                // two octets
+            *(result++) = static_cast<uint8_t>((cp >> 6)            | 0xc0);
+            *(result++) = static_cast<uint8_t>((cp & 0x3f)          | 0x80);
+        }
+        else if (cp < 0x10000) {              // three octets
+            *(result++) = static_cast<uint8_t>((cp >> 12)           | 0xe0);
+            *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f)   | 0x80);
+            *(result++) = static_cast<uint8_t>((cp & 0x3f)          | 0x80);
+        }
+        else {      // four octets
+            *(result++) = static_cast<uint8_t>((cp >> 18)           | 0xf0);
+            *(result++) = static_cast<uint8_t>(((cp >> 12) & 0x3f)  | 0x80);
+            *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f)   | 0x80);
+            *(result++) = static_cast<uint8_t>((cp & 0x3f)          | 0x80);
+        }
+        return result;
+    }
+
+    template <typename octet_iterator>
+    uint32_t next(octet_iterator& it, octet_iterator end)
+    {
+        uint32_t cp = 0;
+        internal::utf_error err_code = internal::validate_next(it, end, &cp);
+        switch (err_code) {
+            case internal::UTF8_OK :
+                break;
+            case internal::NOT_ENOUGH_ROOM :
+                throw not_enough_room();
+            case internal::INVALID_LEAD :
+            case internal::INCOMPLETE_SEQUENCE :
+            case internal::OVERLONG_SEQUENCE :
+                throw invalid_utf8(*it);
+            case internal::INVALID_CODE_POINT :
+                throw invalid_code_point(cp);
+        }
+        return cp;
+    }
+
+    template <typename octet_iterator>
+    uint32_t peek_next(octet_iterator it, octet_iterator end)
+    {
+        return next(it, end);
+    }
+
+    template <typename octet_iterator>
+    uint32_t prior(octet_iterator& it, octet_iterator start)
+    {
+        // can't do much if it == start
+        if (it == start)
+            throw not_enough_room();
+
+        octet_iterator end = it;
+        // Go back until we hit either a lead octet or start
+        while (internal::is_trail(*(--it)))
+            if (it == start)
+                throw invalid_utf8(*it); // error - no lead byte in the sequence
+        return peek_next(it, end);
+    }
+
+    /// Deprecated in versions that include "prior"
+    template <typename octet_iterator>
+    uint32_t previous(octet_iterator& it, octet_iterator pass_start)
+    {
+        octet_iterator end = it;
+        while (internal::is_trail(*(--it)))
+            if (it == pass_start)
+                throw invalid_utf8(*it); // error - no lead byte in the sequence
+        octet_iterator temp = it;
+        return next(temp, end);
+    }
+
+    template <typename octet_iterator, typename distance_type>
+    void advance (octet_iterator& it, distance_type n, octet_iterator end)
+    {
+        for (distance_type i = 0; i < n; ++i)
+            next(it, end);
+    }
+
+    template <typename octet_iterator>
+    typename std::iterator_traits<octet_iterator>::difference_type
+    distance (octet_iterator first, octet_iterator last)
+    {
+        typename std::iterator_traits<octet_iterator>::difference_type dist;
+        for (dist = 0; first < last; ++dist)
+            next(first, last);
+        return dist;
+    }
+
+    template <typename u16bit_iterator, typename octet_iterator>
+    octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result)
+    {
+        while (start != end) {
+            uint32_t cp = internal::mask16(*start++);
+            // Take care of surrogate pairs first
+            if (internal::is_lead_surrogate(cp)) {
+                if (start != end) {
+                    uint32_t trail_surrogate = internal::mask16(*start++);
+                    if (internal::is_trail_surrogate(trail_surrogate))
+                        cp = (cp << 10) + trail_surrogate + internal::SURROGATE_OFFSET;
+                    else
+                        throw invalid_utf16(static_cast<uint16_t>(trail_surrogate));
+                }
+                else
+                    throw invalid_utf16(static_cast<uint16_t>(cp));
+
+            }
+            // Lone trail surrogate
+            else if (internal::is_trail_surrogate(cp))
+                throw invalid_utf16(static_cast<uint16_t>(cp));
+
+            result = append(cp, result);
+        }
+        return result;
+    }
+
+    template <typename u16bit_iterator, typename octet_iterator>
+    u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result)
+    {
+        while (start != end) {
+            uint32_t cp = next(start, end);
+            if (cp > 0xffff) { //make a surrogate pair
+                *result++ = static_cast<uint16_t>((cp >> 10)   + internal::LEAD_OFFSET);
+                *result++ = static_cast<uint16_t>((cp & 0x3ff) + internal::TRAIL_SURROGATE_MIN);
+            }
+            else
+                *result++ = static_cast<uint16_t>(cp);
+        }
+        return result;
+    }
+
+    template <typename octet_iterator, typename u32bit_iterator>
+    octet_iterator utf32to8 (u32bit_iterator start, u32bit_iterator end, octet_iterator result)
+    {
+        while (start != end)
+            result = append(*(start++), result);
+
+        return result;
+    }
+
+    template <typename octet_iterator, typename u32bit_iterator>
+    u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result)
+    {
+        while (start != end)
+            (*result++) = next(start, end);
+
+        return result;
+    }
+
+    // The iterator class
+    template <typename octet_iterator>
+    class iterator : public std::iterator <std::bidirectional_iterator_tag, uint32_t> {
+      octet_iterator it;
+      octet_iterator range_start;
+      octet_iterator range_end;
+      public:
+      iterator () {};
+      explicit iterator (const octet_iterator& octet_it,
+                         const octet_iterator& range_start,
+                         const octet_iterator& range_end) :
+               it(octet_it), range_start(range_start), range_end(range_end)
+      {
+          if (it < range_start || it > range_end)
+              throw std::out_of_range("Invalid utf-8 iterator position");
+      }
+      // the default "big three" are OK
+      octet_iterator base () const { return it; }
+      uint32_t operator * () const
+      {
+          octet_iterator temp = it;
+          return next(temp, range_end);
+      }
+      bool operator == (const iterator& rhs) const
+      {
+          if (range_start != rhs.range_start || range_end != rhs.range_end)
+              throw std::logic_error("Comparing utf-8 iterators defined with different ranges");
+          return (it == rhs.it);
+      }
+      bool operator != (const iterator& rhs) const
+      {
+          return !(operator == (rhs));
+      }
+      iterator& operator ++ ()
+      {
+          next(it, range_end);
+          return *this;
+      }
+      iterator operator ++ (int)
+      {
+          iterator temp = *this;
+          next(it, range_end);
+          return temp;
+      }
+      iterator& operator -- ()
+      {
+          prior(it, range_start);
+          return *this;
+      }
+      iterator operator -- (int)
+      {
+          iterator temp = *this;
+          prior(it, range_start);
+          return temp;
+      }
+    }; // class iterator
+
+} // namespace utf8
+
+#endif //header guard
+
+

src/libraries/utf8/utf8/core.h

+// Copyright 2006 Nemanja Trifunovic
+
+/*
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+
+#ifndef UTF8_FOR_CPP_CORE_H_2675DCD0_9480_4c0c_B92A_CC14C027B731
+#define UTF8_FOR_CPP_CORE_H_2675DCD0_9480_4c0c_B92A_CC14C027B731
+
+#include <iterator>
+
+namespace utf8
+{
+    // The typedefs for 8-bit, 16-bit and 32-bit unsigned integers
+    // You may need to change them to match your system.
+    // These typedefs have the same names as ones from cstdint, or boost/cstdint
+    typedef unsigned char   uint8_t;
+    typedef unsigned short  uint16_t;
+    typedef unsigned int    uint32_t;
+
+// Helper code - not intended to be directly called by the library users. May be changed at any time
+namespace internal
+{
+    // Unicode constants
+    // Leading (high) surrogates: 0xd800 - 0xdbff
+    // Trailing (low) surrogates: 0xdc00 - 0xdfff
+    const uint16_t LEAD_SURROGATE_MIN  = 0xd800u;
+    const uint16_t LEAD_SURROGATE_MAX  = 0xdbffu;
+    const uint16_t TRAIL_SURROGATE_MIN = 0xdc00u;
+    const uint16_t TRAIL_SURROGATE_MAX = 0xdfffu;
+    const uint16_t LEAD_OFFSET         = LEAD_SURROGATE_MIN - (0x10000 >> 10);
+    const uint32_t SURROGATE_OFFSET    = 0x10000u - (LEAD_SURROGATE_MIN << 10) - TRAIL_SURROGATE_MIN;
+
+    // Maximum valid value for a Unicode code point
+    const uint32_t CODE_POINT_MAX      = 0x0010ffffu;
+
+    template<typename octet_type>
+    inline uint8_t mask8(octet_type oc)
+    {
+        return static_cast<uint8_t>(0xff & oc);
+    }
+    template<typename u16_type>
+    inline uint16_t mask16(u16_type oc)
+    {
+        return static_cast<uint16_t>(0xffff & oc);
+    }
+    template<typename octet_type>
+    inline bool is_trail(octet_type oc)
+    {
+        return ((mask8(oc) >> 6) == 0x2);
+    }
+
+    template <typename u16>
+    inline bool is_lead_surrogate(u16 cp)
+    {
+        return (cp >= LEAD_SURROGATE_MIN && cp <= LEAD_SURROGATE_MAX);
+    }
+
+    template <typename u16>
+    inline bool is_trail_surrogate(u16 cp)
+    {
+        return (cp >= TRAIL_SURROGATE_MIN && cp <= TRAIL_SURROGATE_MAX);
+    }
+
+    template <typename u16>
+    inline bool is_surrogate(u16 cp)
+    {
+        return (cp >= LEAD_SURROGATE_MIN && cp <= TRAIL_SURROGATE_MAX);
+    }
+
+    template <typename u32>
+    inline bool is_code_point_valid(u32 cp)
+    {
+        return (cp <= CODE_POINT_MAX && !is_surrogate(cp));
+    }
+
+    template <typename octet_iterator>
+    inline typename std::iterator_traits<octet_iterator>::difference_type
+    sequence_length(octet_iterator lead_it)
+    {
+        uint8_t lead = mask8(*lead_it);
+        if (lead < 0x80)
+            return 1;
+        else if ((lead >> 5) == 0x6)
+            return 2;
+        else if ((lead >> 4) == 0xe)
+            return 3;
+        else if ((lead >> 3) == 0x1e)
+            return 4;
+        else
+            return 0;
+    }
+
+    template <typename octet_difference_type>
+    inline bool is_overlong_sequence(uint32_t cp, octet_difference_type length)
+    {
+        if (cp < 0x80) {
+            if (length != 1) 
+                return true;
+        }
+        else if (cp < 0x800) {
+            if (length != 2) 
+                return true;
+        }
+        else if (cp < 0x10000) {
+            if (length != 3) 
+                return true;
+        }
+
+        return false;
+    }
+
+    enum utf_error {UTF8_OK, NOT_ENOUGH_ROOM, INVALID_LEAD, INCOMPLETE_SEQUENCE, OVERLONG_SEQUENCE, INVALID_CODE_POINT};
+
+    /// get_sequence_x functions decode utf-8 sequences of the length x
+
+    template <typename octet_iterator>
+    utf_error get_sequence_1(octet_iterator& it, octet_iterator end, uint32_t* code_point)
+    {
+        if (it != end) {
+            if (code_point)
+                *code_point = mask8(*it);
+            return UTF8_OK;
+        }
+        return NOT_ENOUGH_ROOM;
+    }
+
+    template <typename octet_iterator>
+    utf_error get_sequence_2(octet_iterator& it, octet_iterator end, uint32_t* code_point)
+    {
+        utf_error ret_code = NOT_ENOUGH_ROOM;
+
+        if (it != end) {
+            uint32_t cp = mask8(*it);
+            if (++it != end) {
+                if (is_trail(*it)) {
+                    cp = ((cp << 6) & 0x7ff) + ((*it) & 0x3f);
+
+                    if (code_point)
+                        *code_point = cp;
+                    ret_code = UTF8_OK;
+                }
+                else
+                    ret_code = INCOMPLETE_SEQUENCE;
+            }
+            else
+                ret_code = NOT_ENOUGH_ROOM;
+        }
+
+        return ret_code;
+    }
+
+    template <typename octet_iterator>
+    utf_error get_sequence_3(octet_iterator& it, octet_iterator end, uint32_t* code_point)
+    {
+        utf_error ret_code = NOT_ENOUGH_ROOM;
+
+        if (it != end) {
+            uint32_t cp = mask8(*it);
+            if (++it != end) {
+                if (is_trail(*it)) {
+                    cp = ((cp << 12) & 0xffff) + ((mask8(*it) << 6) & 0xfff);
+                    if (++it != end) {
+                        if (is_trail(*it)) {
+                            cp += (*it) & 0x3f;
+
+                            if (code_point)
+                                *code_point = cp;
+                            ret_code = UTF8_OK;
+                        }
+                        else 
+                            ret_code = INCOMPLETE_SEQUENCE;
+                    }
+                    else
+                        ret_code = NOT_ENOUGH_ROOM;
+                }
+                else
+                    ret_code = INCOMPLETE_SEQUENCE;
+            }
+            else
+                ret_code = NOT_ENOUGH_ROOM;
+        }
+
+        return ret_code;
+    }
+
+    template <typename octet_iterator>
+    utf_error get_sequence_4(octet_iterator& it, octet_iterator end, uint32_t* code_point)
+    {
+        utf_error ret_code = NOT_ENOUGH_ROOM;
+
+        if (it != end) {
+            uint32_t cp = mask8(*it);
+            if (++it != end) {
+                if (is_trail(*it)) {
+                    cp = ((cp << 18) & 0x1fffff) + ((mask8(*it) << 12) & 0x3ffff);
+                    if (++it != end) {
+                        if (is_trail(*it)) {
+                            cp += (mask8(*it) << 6) & 0xfff;
+                            if (++it != end) {
+                                if (is_trail(*it)) {
+                                    cp += (*it) & 0x3f;
+
+                                    if (code_point)
+                                        *code_point = cp;
+                                    ret_code = UTF8_OK;
+                                }
+                                else
+                                    ret_code = INCOMPLETE_SEQUENCE;
+                            }
+                            else
+                                ret_code = NOT_ENOUGH_ROOM;
+                        }
+                        else
+                            ret_code = INCOMPLETE_SEQUENCE;
+                    }
+                    else
+                        ret_code = NOT_ENOUGH_ROOM;
+                }
+                else 
+                    ret_code = INCOMPLETE_SEQUENCE;
+            }
+            else
+                ret_code = NOT_ENOUGH_ROOM;
+        }
+
+        return ret_code;
+    }
+
+    template <typename octet_iterator>
+    utf_error validate_next(octet_iterator& it, octet_iterator end, uint32_t* code_point)
+    {
+        // Save the original value of it so we can go back in case of failure
+        // Of course, it does not make much sense with i.e. stream iterators
+        octet_iterator original_it = it;
+
+        uint32_t cp = 0;
+        // Determine the sequence length based on the lead octet
+        typedef typename std::iterator_traits<octet_iterator>::difference_type octet_difference_type;
+        octet_difference_type length = sequence_length(it);
+        if (length == 0)
+            return INVALID_LEAD;
+
+        // Now that we have a valid sequence length, get trail octets and calculate the code point
+        utf_error err = UTF8_OK;
+        switch (length) {
+            case 1:
+                err = get_sequence_1(it, end, &cp);
+                break;
+            case 2:
+                err = get_sequence_2(it, end, &cp);
+            break;
+            case 3:
+                err = get_sequence_3(it, end, &cp);
+            break;
+            case 4:
+                err = get_sequence_4(it, end, &cp);
+            break;
+        }
+
+        if (err == UTF8_OK) {
+            // Decoding succeeded. Now, security checks...
+            if (is_code_point_valid(cp)) {
+                if (!is_overlong_sequence(cp, length)){
+                    // Passed! Return here.
+                    if (code_point)
+                        *code_point = cp;
+                    ++it;
+                    return UTF8_OK;
+                }
+                else
+                    err = OVERLONG_SEQUENCE;
+            }
+            else 
+                err = INVALID_CODE_POINT;
+        }
+
+        // Failure branch - restore the original value of the iterator
+        it = original_it;
+        return err;
+    }
+
+    template <typename octet_iterator>
+    inline utf_error validate_next(octet_iterator& it, octet_iterator end) {
+        return validate_next(it, end, 0);
+    }
+
+} // namespace internal
+
+    /// The library API - functions intended to be called by the users
+
+    // Byte order mark
+    const uint8_t bom[] = {0xef, 0xbb, 0xbf};
+
+    template <typename octet_iterator>
+    octet_iterator find_invalid(octet_iterator start, octet_iterator end)
+    {
+        octet_iterator result = start;
+        while (result != end) {
+            internal::utf_error err_code = internal::validate_next(result, end);
+            if (err_code != internal::UTF8_OK)
+                return result;
+        }
+        return result;
+    }
+
+    template <typename octet_iterator>
+    inline bool is_valid(octet_iterator start, octet_iterator end)
+    {
+        return (find_invalid(start, end) == end);
+    }
+
+    template <typename octet_iterator>
+    inline bool starts_with_bom (octet_iterator it, octet_iterator end)
+    {
+        return (
+            ((it != end) && (internal::mask8(*it++)) == bom[0]) &&
+            ((it != end) && (internal::mask8(*it++)) == bom[1]) &&
+            ((it != end) && (internal::mask8(*it))   == bom[2])
+           );
+    }
+	
+	//Deprecated in release 2.3 
+    template <typename octet_iterator>
+    inline bool is_bom (octet_iterator it)
+    {
+        return (
+            (internal::mask8(*it++)) == bom[0] &&
+            (internal::mask8(*it++)) == bom[1] &&
+            (internal::mask8(*it))   == bom[2]
+           );
+    }
+} // namespace utf8
+
+#endif // header guard
+
+

src/libraries/utf8/utf8/unchecked.h

+// Copyright 2006 Nemanja Trifunovic
+
+/*
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+
+#ifndef UTF8_FOR_CPP_UNCHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731
+#define UTF8_FOR_CPP_UNCHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731
+
+#include "core.h"
+
+namespace utf8
+{
+    namespace unchecked 
+    {
+        template <typename octet_iterator>
+        octet_iterator append(uint32_t cp, octet_iterator result)
+        {
+            if (cp < 0x80)                        // one octet
+                *(result++) = static_cast<uint8_t>(cp);  
+            else if (cp < 0x800) {                // two octets
+                *(result++) = static_cast<uint8_t>((cp >> 6)          | 0xc0);
+                *(result++) = static_cast<uint8_t>((cp & 0x3f)        | 0x80);
+            }
+            else if (cp < 0x10000) {              // three octets
+                *(result++) = static_cast<uint8_t>((cp >> 12)         | 0xe0);
+                *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
+                *(result++) = static_cast<uint8_t>((cp & 0x3f)        | 0x80);
+            }
+            else {                                // four octets
+                *(result++) = static_cast<uint8_t>((cp >> 18)         | 0xf0);
+                *(result++) = static_cast<uint8_t>(((cp >> 12) & 0x3f)| 0x80);
+                *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
+                *(result++) = static_cast<uint8_t>((cp & 0x3f)        | 0x80);
+            }
+            return result;
+        }
+
+        template <typename octet_iterator>
+        uint32_t next(octet_iterator& it)
+        {
+            uint32_t cp = internal::mask8(*it);
+            typename std::iterator_traits<octet_iterator>::difference_type length = utf8::internal::sequence_length(it);
+            switch (length) {
+                case 1:
+                    break;
+                case 2:
+                    it++;
+                    cp = ((cp << 6) & 0x7ff) + ((*it) & 0x3f);
+                    break;
+                case 3:
+                    ++it; 
+                    cp = ((cp << 12) & 0xffff) + ((internal::mask8(*it) << 6) & 0xfff);
+                    ++it;
+                    cp += (*it) & 0x3f;
+                    break;
+                case 4:
+                    ++it;
+                    cp = ((cp << 18) & 0x1fffff) + ((internal::mask8(*it) << 12) & 0x3ffff);                
+                    ++it;
+                    cp += (internal::mask8(*it) << 6) & 0xfff;
+                    ++it;
+                    cp += (*it) & 0x3f; 
+                    break;
+            }
+            ++it;
+            return cp;        
+        }
+
+        template <typename octet_iterator>
+        uint32_t peek_next(octet_iterator it)
+        {
+            return next(it);    
+        }
+
+        template <typename octet_iterator>
+        uint32_t prior(octet_iterator& it)
+        {
+            while (internal::is_trail(*(--it))) ;
+            octet_iterator temp = it;
+            return next(temp);
+        }
+
+        // Deprecated in versions that include prior, but only for the sake of consistency (see utf8::previous)
+        template <typename octet_iterator>
+        inline uint32_t previous(octet_iterator& it)
+        {
+            return prior(it);
+        }
+
+        template <typename octet_iterator, typename distance_type>
+        void advance (octet_iterator& it, distance_type n)
+        {
+            for (distance_type i = 0; i < n; ++i)
+                next(it);
+        }
+
+        template <typename octet_iterator>
+        typename std::iterator_traits<octet_iterator>::difference_type
+        distance (octet_iterator first, octet_iterator last)
+        {
+            typename std::iterator_traits<octet_iterator>::difference_type dist;
+            for (dist = 0; first < last; ++dist) 
+                next(first);
+            return dist;
+        }
+
+        template <typename u16bit_iterator, typename octet_iterator>
+        octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result)
+        {       
+            while (start != end) {
+                uint32_t cp = internal::mask16(*start++);
+            // Take care of surrogate pairs first
+                if (internal::is_lead_surrogate(cp)) {
+                    uint32_t trail_surrogate = internal::mask16(*start++);
+                    cp = (cp << 10) + trail_surrogate + internal::SURROGATE_OFFSET;
+                }
+                result = append(cp, result);
+            }
+            return result;         
+        }
+
+        template <typename u16bit_iterator, typename octet_iterator>
+        u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result)
+        {
+            while (start < end) {
+                uint32_t cp = next(start);
+                if (cp > 0xffff) { //make a surrogate pair
+                    *result++ = static_cast<uint16_t>((cp >> 10)   + internal::LEAD_OFFSET);
+                    *result++ = static_cast<uint16_t>((cp & 0x3ff) + internal::TRAIL_SURROGATE_MIN);
+                }
+                else
+                    *result++ = static_cast<uint16_t>(cp);
+            }
+            return result;
+        }
+
+        template <typename octet_iterator, typename u32bit_iterator>
+        octet_iterator utf32to8 (u32bit_iterator start, u32bit_iterator end, octet_iterator result)
+        {
+            while (start != end)
+                result = append(*(start++), result);
+
+            return result;
+        }
+
+        template <typename octet_iterator, typename u32bit_iterator>
+        u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result)
+        {
+            while (start < end)
+                (*result++) = next(start);
+
+            return result;
+        }
+
+        // The iterator class
+        template <typename octet_iterator>
+          class iterator : public std::iterator <std::bidirectional_iterator_tag, uint32_t> { 
+            octet_iterator it;
+            public:
+            iterator () {};
+            explicit iterator (const octet_iterator& octet_it): it(octet_it) {}
+            // the default "big three" are OK
+            octet_iterator base () const { return it; }
+            uint32_t operator * () const
+            {
+                octet_iterator temp = it;
+                return next(temp);
+            }
+            bool operator == (const iterator& rhs) const 
+            { 
+                return (it == rhs.it);
+            }
+            bool operator != (const iterator& rhs) const
+            {
+                return !(operator == (rhs));
+            }
+            iterator& operator ++ () 
+            {
+                std::advance(it, internal::sequence_length(it));
+                return *this;
+            }
+            iterator operator ++ (int)
+            {
+                iterator temp = *this;
+                std::advance(it, internal::sequence_length(it));
+                return temp;
+            }  
+            iterator& operator -- ()
+            {
+                prior(it);
+                return *this;
+            }
+            iterator operator -- (int)
+            {
+                iterator temp = *this;
+                prior(it);
+                return temp;
+            }
+          }; // class iterator
+
+    } // namespace utf8::unchecked
+} // namespace utf8 
+
+
+#endif // header guard
+
 #include <common/config.h>
 #include <common/version.h>
 #include <common/runtime.h>
-#include <common/MemoryData.h>
 
 #ifdef LOVE_WINDOWS
 #include <windows.h>

src/modules/audio/Source.cpp

 	{
 		return types.find(in, out);
 	}
+	
+	bool Source::getConstant(const char * in, Unit & out)
+	{
+		return units.find(in, out);
+	}
+	
+	bool Source::getConstant(Unit in, const char *& out)
+	{
+		return units.find(in, out);
+	}
 
 	StringMap<Source::Type, Source::TYPE_MAX_ENUM>::Entry Source::typeEntries[] =
 	{
 	};
 
 	StringMap<Source::Type, Source::TYPE_MAX_ENUM> Source::types(Source::typeEntries, sizeof(Source::typeEntries));
+	
+	StringMap<Source::Unit, Source::UNIT_MAX_ENUM>::Entry Source::unitEntries[] =
+	{
+		{"seconds", Source::UNIT_SECONDS},
+		{"samples", Source::UNIT_SAMPLES},
+	};
+	
+	StringMap<Source::Unit, Source::UNIT_MAX_ENUM> Source::units(Source::unitEntries, sizeof(Source::unitEntries));
 
 } // audio
 } // love

src/modules/audio/Source.h

 			TYPE_STREAM,
 			TYPE_MAX_ENUM
 		}; // Type
+		
+		enum Unit
+		{
+			UNIT_SECONDS = 1,
+			UNIT_SAMPLES,
+			UNIT_MAX_ENUM
+		};
 
 	protected:
 		Type type;
 
 		virtual void setVolume(float volume) = 0;
 		virtual float getVolume() const = 0;
+		
+		virtual void seek(float offset, Unit unit) = 0;
+		virtual float tell(Unit unit) const = 0;
 
 		// all float * v must be of size 3
 		virtual void setPosition(float * v) = 0;
 
 		static bool getConstant(const char * in, Type & out);
 		static bool getConstant(Type in, const char *& out);
+		static bool getConstant(const char * in, Unit & out);
+		static bool getConstant(Unit in, const char *& out);
 
 	private:
 
 		static StringMap<Type, TYPE_MAX_ENUM>::Entry typeEntries[];
 		static StringMap<Type, TYPE_MAX_ENUM> types;
+		static StringMap<Unit, UNIT_MAX_ENUM>::Entry unitEntries[];
+		static StringMap<Unit, UNIT_MAX_ENUM> units;
 
 	}; // Source
 

src/modules/audio/null/Source.cpp

 	{
 		return volume;
 	}
+	
+	void Source::seek(float, Source::Unit)
+	{
+	}
+	
+	float Source::tell(Source::Unit) const
+	{
+		return 0.0f;
+	}
 
 	void Source::setPosition(float *)
 	{

src/modules/audio/null/Source.h

 		virtual float getPitch() const;
 		virtual void setVolume(float volume);
 		virtual float getVolume() const;
+		virtual void seek(float offset, Unit unit);
+		virtual float tell(Unit unit) const;
 		virtual void setPosition(float * v);
 		virtual void getPosition(float * v) const;
 		virtual void setVelocity(float * v);

src/modules/audio/openal/Source.cpp

 
 	Source::Source(Pool * pool, love::sound::SoundData * soundData)
 		: love::audio::Source(Source::TYPE_STATIC), pool(pool), valid(false),
-		pitch(1.0f), volume(1.0f), looping(false), decoder(0)
+		pitch(1.0f), volume(1.0f), looping(false), offsetSamples(0), offsetSeconds(0), decoder(0)
 	{
 		alGenBuffers(1, buffers);
 		ALenum fmt = getFormat(soundData->getChannels(), soundData->getBits());
 
 	Source::Source(Pool * pool, love::sound::Decoder * decoder)
 		: love::audio::Source(Source::TYPE_STREAM), pool(pool), valid(false),
-		pitch(1.0f), volume(1.0f), looping(false), decoder(decoder)
+		pitch(1.0f), volume(1.0f), looping(false), offsetSamples(0), offsetSeconds(0), decoder(decoder)
 	{
 		decoder->retain();
 		alGenBuffers(MAX_BUFFERS, buffers);
 			while(processed--)
 			{
 				ALuint buffer;
-
+				
+				float curOffsetSamples, curOffsetSecs;
+				
+				alGetSourcef(source, AL_SAMPLE_OFFSET, &curOffsetSamples);
+				
+				ALint b;
+				alGetSourcei(source, AL_BUFFER, &b);
+				int freq;
+				alGetBufferi(b, AL_FREQUENCY, &freq);
+				curOffsetSecs = curOffsetSamples / freq;
+				
 				// Get a free buffer.
 				alSourceUnqueueBuffers(source, 1, &buffer);
-
+				
+				float newOffsetSamples, newOffsetSecs;
+				
+				alGetSourcef(source, AL_SAMPLE_OFFSET, &newOffsetSamples);
+				newOffsetSecs = newOffsetSamples / freq;
+				
+				offsetSamples += (curOffsetSamples - newOffsetSamples);
+				offsetSeconds += (curOffsetSecs - newOffsetSecs);
+				
 				if(streamAtomic(buffer, decoder) > 0)
 					alSourceQueueBuffers(source, 1, &buffer);
 			}
 		// In case the Source isn't playing.
 		return volume;
 	}
+	
+	void Source::seek(float offset, Source::Unit unit)
+	{
+		if (valid)
+		{
+			switch (unit) {
+				case Source::UNIT_SAMPLES:
+					if (type == TYPE_STREAM) {
+						ALint buffer;
+						alGetSourcei(source, AL_BUFFER, &buffer);
+						int freq;
+						alGetBufferi(buffer, AL_FREQUENCY, &freq);
+						offset /= freq;
+						decoder->seek(offset);
+					} else {
+						alSourcef(source, AL_SAMPLE_OFFSET, offset);
+					}
+					break;
+				case Source::UNIT_SECONDS:	
+				default:
+					if (type == TYPE_STREAM) {
+						decoder->seek(offset);
+					} else {
+						alSourcef(source, AL_SEC_OFFSET, offset);
+					}
+					break;
+			}
+		}
+	}
+	
+	float Source::tell(Source::Unit unit) const
+	{
+		if (valid)
+		{
+			float offset;
+			switch (unit) {
+				case Source::UNIT_SAMPLES:
+					alGetSourcef(source, AL_SAMPLE_OFFSET, &offset);
+					if (type == TYPE_STREAM) offset += offsetSamples;
+					break;
+				case Source::UNIT_SECONDS:
+				default:
+					alGetSourcef(source, AL_SAMPLE_OFFSET, &offset);
+					ALint buffer;
+					alGetSourcei(source, AL_BUFFER, &buffer);
+					int freq;
+					alGetBufferi(buffer, AL_FREQUENCY, &freq);
+					offset /= freq;
+					if (type == TYPE_STREAM) offset += offsetSeconds;
+					break;
+			}
+			return offset;
+		}
+		return 0.0f;
+	}
 
 	void Source::setPosition(float * v)
 	{
 		else if(valid && type == TYPE_STREAM)
 		{
 			decoder->rewind();
+			offsetSamples = 0;
+			offsetSeconds = 0;
 		}
 	}
 
 		if(decoded > 0 && fmt != 0)
 			alBufferData(buffer, fmt, d->getBuffer(), decoded, d->getSampleRate());
 
-		if(decoded < d->getSize() && isLooping())
+		if(decoded < d->getSize() && isLooping()) {
+			offsetSamples = 0;
+			offsetSeconds = 0;
 			d->rewind();
+		}
 
 		return decoded;
 	}

src/modules/audio/openal/Source.h

 		float velocity[3];
 		float direction[3];
 		bool looping;
+		
+		float offsetSamples;
+		float offsetSeconds;
 
 		love::sound::Decoder * decoder;
 
 		virtual float getPitch() const;
 		virtual void setVolume(float volume);
 		virtual float getVolume() const;
+		virtual void seek(float offset, Unit unit);
+		virtual float tell(Unit unit) const;
 		virtual void setPosition(float * v);
 		virtual void getPosition(float * v) const;
 		virtual void setVelocity(float * v);
Add a comment to this file

src/modules/audio/wrap_Audio.cpp

File contents unchanged.

Add a comment to this file

src/modules/audio/wrap_Audio.h

File contents unchanged.

src/modules/audio/wrap_Source.cpp

 		lua_pushnumber(L, t->getVolume());
 		return 1;
 	}
+	
+	int w_Source_seek(lua_State * L)
+	{
+		Source * t = luax_checksource(L, 1);
+		float offset = (float)luaL_checknumber(L, 2);
+		const char * unit = luaL_optstring(L, 3, "seconds");
+		Source::Unit u;
+		t->getConstant(unit, u);
+		t->seek(offset, u);
+		return 0;
+	}
+	
+	int w_Source_tell(lua_State * L)
+	{
+		Source * t = luax_checksource(L, 1);
+		const char * unit = luaL_optstring(L, 2, "seconds");
+		Source::Unit u;
+		t->getConstant(unit, u);
+		lua_pushnumber(L, t->tell(u));
+		return 1;
+	}
 
 	int w_Source_setPosition(lua_State * L)
 	{
 		{ "getPitch", w_Source_getPitch },
 		{ "setVolume", w_Source_setVolume },
 		{ "getVolume", w_Source_getVolume },
+		{ "seek", w_Source_seek },
+		{ "tell", w_Source_tell },
 		{ "setPosition", w_Source_setPosition },
 		{ "getPosition", w_Source_getPosition },
 		{ "setVelocity", w_Source_setVelocity },

src/modules/audio/wrap_Source.h

 	int w_Source_getPitch(lua_State * L);
 	int w_Source_setVolume(lua_State * L);
 	int w_Source_getVolume(lua_State * L);
+	int w_Source_seek(lua_State * L);
+	int w_Source_tell(lua_State * L);
 	int w_Source_setPosition(lua_State * L);
 	int w_Source_getPosition(lua_State * L);
 	int w_Source_setVelocity(lua_State * L);
Add a comment to this file

src/modules/event/sdl/wrap_Event.cpp

File contents unchanged.

Add a comment to this file

src/modules/event/sdl/wrap_Event.h

File contents unchanged.

Add a comment to this file

src/modules/filesystem/physfs/wrap_Filesystem.cpp

File contents unchanged.

Add a comment to this file

src/modules/filesystem/physfs/wrap_Filesystem.h

File contents unchanged.

src/modules/font/Font.h

 #define LOVE_FONT_FONT_H
 
 // LOVE
-#include "FontData.h"
 #include "Rasterizer.h"
 #include <image/ImageData.h>
 #include <common/Module.h>
 		virtual Rasterizer * newRasterizer(love::image::ImageData * data, std::string glyphs) = 0;
 		virtual Rasterizer * newRasterizer(love::image::ImageData * data, unsigned short * glyphs, int length) = 0;
 		virtual GlyphData * newGlyphData(Rasterizer * r, unsigned short glyph) = 0;
-		virtual FontData * newFontData(Rasterizer * r) = 0;
 
 		// Implement Module
 		virtual const char * getName() const = 0;

src/modules/font/FontData.cpp

-/**
-* Copyright (c) 2006-2011 LOVE Development Team
-*
-* This software is provided 'as-is', without any express or implied
-* warranty.  In no event will the authors be held liable for any damages
-* arising from the use of this software.
-*
-* Permission is granted to anyone to use this software for any purpose,
-* including commercial applications, and to alter it and redistribute it
-* freely, subject to the following restrictions: