FreeTypeを使う 新しいページはコチラ

提供: yonewiki
移動: 案内, 検索
(サンプル3.公式サイトのErik Mollerさん作成 Qt版)
(サンプル3.公式サイトのErik Mollerさん作成 Qt版)
974行: 974行:
 
     //std::ifstream fontFile(argv[1], std::ios::binary);
 
     //std::ifstream fontFile(argv[1], std::ios::binary);
 
     std::ifstream fontFile(filename.toUtf8(), std::ios::binary);
 
     std::ifstream fontFile(filename.toUtf8(), std::ios::binary);
     if (fontFile) {
+
     if (fontFile) { /*フォントファイル名情報処理*/
         fontFile.seekg(0, std::ios::end);
+
         fontFile.seekg(0, std::ios::end); //読み取り位置を 最後 に
         std::fstream::pos_type fontFileSize = fontFile.tellg();
+
         std::fstream::pos_type fontFileSize = fontFile.tellg(); 現在位置を pos_type型 変数へ格納
         fontFile.seekg(0);
+
         fontFile.seekg(0);//読み取り位置を 0 に
         unsigned char* fontBuffer = new unsigned char[fontFileSize];
+
         unsigned char* fontBuffer = new unsigned char[fontFileSize];  
 +
//読み取り位置最後はファイルサイズなので、その大きさのchar型変数配列 fontBufferを作成
 
         fontFile.read((char*)fontBuffer, fontFileSize);
 
         fontFile.read((char*)fontBuffer, fontFileSize);
 +
//Fontファイルの内容をfontBufferへfontFileSizeの長さだけフォントファイル名取得
  
 
         FT_New_Memory_Face(library, fontBuffer, fontFileSize, 0, &face);
 
         FT_New_Memory_Face(library, fontBuffer, fontFileSize, 0, &face);
 +
//読み取ったフォントファイル名情報で&faceを初期化
  
 
         WriteGlyphAsTGA(library, "C:/FreeTypeStep03Test.tga"/*QString_TgaFileName.constData()*/, L'B', face, 100, Pixel32(255, 90, 30), Pixel32(255, 255, 255), 3.0f);
 
         WriteGlyphAsTGA(library, "C:/FreeTypeStep03Test.tga"/*QString_TgaFileName.constData()*/, L'B', face, 100, Pixel32(255, 90, 30), Pixel32(255, 255, 255), 3.0f);

2022年8月20日 (土) 00:00時点における版



個人用ツール
名前空間

変種
操作
案内
ツールボックス