| @@ -180,7 +180,6 @@ end; | |||
| function TtsFontGeneratorFreeType.CreateFont(const aFace: FT_Face; const aRenderer: TtsRenderer; const aSize: Integer; | |||
| const aStyle: TtsFontStyles; const aAntiAliasing: TtsAntiAliasing): TtsFont; | |||
| var | |||
| face: FT_Face; | |||
| err: FT_Error; | |||
| prop: TtsFontProperties; | |||
| os2: PTT_OS2; | |||
| @@ -17,7 +17,7 @@ type | |||
| fHandle: THandle; | |||
| fMat2: TMat2; | |||
| protected | |||
| constructor Create(const aRenderer: TtsRenderer; const aCreator: TtsFontGenerator; const aProperties: TtsFontProperties; const aHandle: THandle); | |||
| {%H-}constructor Create(const aRenderer: TtsRenderer; const aCreator: TtsFontGenerator; const aProperties: TtsFontProperties; const aHandle: THandle); | |||
| public | |||
| destructor Destroy; override; | |||
| end; | |||
| @@ -225,7 +225,7 @@ begin | |||
| try | |||
| SelectObject(DC, aFont.fHandle); | |||
| if Assigned(GetCharacterPlacementW) then begin | |||
| FillChar(GCPRes, SizeOf(GCPRes), #0); | |||
| FillChar(GCPRes{%H-}, SizeOf(GCPRes), #0); | |||
| GetMem(GCPRes.lpGlyphs, SizeOf(Cardinal)); | |||
| try | |||
| GCPRes.lStructSize := SizeOf(GCPRes); | |||
| @@ -278,7 +278,7 @@ var | |||
| begin | |||
| if (aFont.fMat2.eM11.value <> 1) then | |||
| raise EtsException.Create('invalid value'); | |||
| FillChar(Metric, SizeOf(Metric), #0); | |||
| FillChar(Metric{%H-}, SizeOf(Metric), #0); | |||
| GlyphIndex := GetGlyphIndex(aFont, aCharCode); | |||
| if (GlyphIndex < 0) then | |||
| @@ -339,7 +339,7 @@ var | |||
| end; | |||
| begin | |||
| FillChar(Metric, SizeOf(Metric), #0); | |||
| FillChar(Metric{%H-}, SizeOf(Metric), #0); | |||
| GlyphIndex := GetGlyphIndex(aFont, aCharCode); | |||
| if (GlyphIndex < 0) then | |||
| @@ -404,14 +404,14 @@ var | |||
| end; | |||
| begin | |||
| FillChar(aProperties, SizeOf(aProperties), #0); | |||
| FillChar(aProperties{%H-}, SizeOf(aProperties), #0); | |||
| aProperties.Size := aSize; | |||
| aProperties.Style := aStyle; | |||
| aProperties.AntiAliasing := aAntiAliasing; | |||
| aProperties.Fontname := aFontname; | |||
| // prepare font attribs | |||
| FillChar(LogFont, SizeOf(LogFont), #0); | |||
| FillChar(LogFont{%H-}, SizeOf(LogFont), #0); | |||
| tmpName := AnsiString(aFontname); | |||
| for i := 1 to min(Length(aFontname), Length(LogFont.lfFaceName)) do | |||
| LogFont.lfFaceName[i-1] := tmpName[i]; | |||
| @@ -445,14 +445,14 @@ begin | |||
| end; | |||
| end; | |||
| if GetTextMetricsW(DC, TextMetric) then begin | |||
| if GetTextMetricsW(DC, TextMetric{%H-}) then begin | |||
| aProperties.Ascent := TextMetric.tmAscent; | |||
| aProperties.Descent := TextMetric.tmDescent; | |||
| aProperties.ExternalLeading := TextMetric.tmExternalLeading; | |||
| aProperties.DefaultChar := TextMetric.tmDefaultChar; | |||
| end; | |||
| if (GetOutlineTextMetricsW(DC, SizeOf(OutlineMetric), OutlineMetric) > 0) then begin | |||
| if (GetOutlineTextMetricsW(DC, SizeOf(OutlineMetric), OutlineMetric{%H-}) > 0) then begin | |||
| aProperties.UnderlinePos := OutlineMetric.otmsUnderscorePosition; | |||
| aProperties.UnderlineSize := Min(1, OutlineMetric.otmsUnderscoreSize); | |||
| aProperties.StrikeoutPos := OutlineMetric.otmsStrikeoutPosition; | |||
| @@ -251,13 +251,13 @@ begin | |||
| // create new texture | |||
| if not Assigned(result) then begin | |||
| if (aCharImage.Width > TextureSize) or (aCharImage.Height > TextureSize) then | |||
| raise EtsRendererOpenGL.Create('char is to large to fit into a texture: ' + aChar.CharCode + ' (0x' + IntToHex(Ord(aChar.CharCode), 4) + ')'); | |||
| raise EtsRendererOpenGL.Create('char is to large to fit into a texture: (0x' + IntToHex(Ord(aChar.CharCode), 4) + ')'); | |||
| tex := CreateNewTexture; | |||
| result := AddToTexture(tex); | |||
| end; | |||
| if not Assigned(result) then | |||
| raise EtsRendererOpenGL.Create('unable to creat render reference for char: ' + aChar.CharCode + ' (0x' + IntToHex(Ord(aChar.CharCode), 4) + ')'); | |||
| raise EtsRendererOpenGL.Create('unable to creat render reference for char: (0x' + IntToHex(Ord(aChar.CharCode), 4) + ')'); | |||
| end; | |||
| //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| @@ -68,9 +68,6 @@ type | |||
| implementation | |||
| uses | |||
| Math; | |||
| //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| //TtsPostProcessFillColor/////////////////////////////////////////////////////////////////////////////////////////////// | |||
| //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| @@ -145,7 +145,7 @@ type | |||
| //function GetCharCreate(const aCharCode: WideChar): TtsChar; | |||
| procedure AddChar(const aCharCode: WideChar; const aChar: TtsChar); overload; | |||
| protected | |||
| constructor Create(const aRenderer: TtsRenderer; const aGenerator: TtsFontGenerator; const aProperties: TtsFontProperties); | |||
| {%H-}constructor Create(const aRenderer: TtsRenderer; const aGenerator: TtsFontGenerator; const aProperties: TtsFontProperties); | |||
| public | |||
| property CreateChars: Boolean read fCreateChars write fCreateChars; | |||
| property Char[const aCharCode: WideChar]: TtsChar read GetChar; | |||
| @@ -337,7 +337,7 @@ type | |||
| protected | |||
| property Lines: PtsBlockLine read fFirstLine; | |||
| procedure PushNewLine; | |||
| constructor Create(const aRenderer: TtsRenderer; const aTop, aLeft, aWidth, aHeight: Integer; const aFlags: TtsBlockFlags); | |||
| {%H-}constructor Create(const aRenderer: TtsRenderer; const aTop, aLeft, aWidth, aHeight: Integer; const aFlags: TtsBlockFlags); | |||
| public | |||
| property Renderer: TtsRenderer read fRenderer; | |||
| property CurrentColor: TtsColor4f read fCurrentColor; | |||
| @@ -16,7 +16,7 @@ const | |||
| NAME_ID_FULL_NAME = 4; | |||
| function MakeTTTableName(const ch1, ch2, ch3, ch4: Char): Cardinal; | |||
| function GetTTString(pBuffer: Pointer; BufferSize: Integer; NameID, LanguageID: Cardinal; var Text: String): Boolean; | |||
| function GetTTString(pBuffer: Pointer; BufferSize: Integer; NameID, LanguageID: Cardinal; out Text: String): Boolean; | |||
| function GetTTFontFullNameFromStream(Stream: TStream; LanguageID: Cardinal): String; | |||
| function GetTTFontFullNameFromFile(const aFilename: String; const aLanguageID: Cardinal): String; | |||
| @@ -98,7 +98,7 @@ begin | |||
| Pos := Stream.Position; | |||
| // Reading table header | |||
| Stream.Read(OffsetTable, sizeof(TT_OFFSET_TABLE)); | |||
| Stream.Read(OffsetTable{%H-}, sizeof(TT_OFFSET_TABLE)); | |||
| OffsetTable.uNumOfTables := SWAPWORD(OffsetTable.uNumOfTables); | |||
| OffsetTable.uMajorVersion := SWAPWORD(OffsetTable.uMajorVersion); | |||
| OffsetTable.uMinorVersion := SWAPWORD(OffsetTable.uMinorVersion); | |||
| @@ -109,7 +109,7 @@ begin | |||
| // seaching table with name | |||
| for Idx := 0 to OffsetTable.uNumOfTables -1 do begin | |||
| Stream.Read(TableDir, sizeof(TT_TABLE_DIRECTORY)); | |||
| Stream.Read(TableDir{%H-}, sizeof(TT_TABLE_DIRECTORY)); | |||
| if (TableName = TableDir.TableName) then begin | |||
| TableDir.uOffset := SWAPLONG(TableDir.uOffset); | |||
| @@ -120,7 +120,7 @@ begin | |||
| Stream.Seek(TableDir.uOffset, soBeginning); | |||
| Size := Stream.Read(pBuff^, TableDir.uLength); | |||
| Result := Size = Integer(TableDir.uLength); | |||
| Result := (Size = Integer(TableDir.uLength)); | |||
| end else | |||
| begin | |||
| @@ -141,7 +141,7 @@ begin | |||
| Result := ord(ch4) shl 24 or ord(ch3) shl 16 or ord(ch2) shl 8 or ord(ch1); | |||
| end; | |||
| function GetTTString(pBuffer: Pointer; BufferSize: Integer; NameID, LanguageID: Cardinal; var Text: String): Boolean; | |||
| function GetTTString(pBuffer: Pointer; BufferSize: Integer; NameID, LanguageID: Cardinal; out Text: String): Boolean; | |||
| var | |||
| pActBuffer: pByte; | |||
| ttNTHeader: TT_NAME_TABLE_HEADER; | |||
| @@ -203,7 +203,7 @@ begin | |||
| pActBuffer := pBuffer; | |||
| Move(pActBuffer^, ttNTHeader, sizeof(TT_NAME_TABLE_HEADER)); | |||
| Move(pActBuffer^, ttNTHeader{%H-}, sizeof(TT_NAME_TABLE_HEADER)); | |||
| inc(pActBuffer, sizeof(TT_NAME_TABLE_HEADER)); | |||
| ttNTHeader.uNRCount := SWAPWORD(ttNTHeader.uNRCount); | |||
| @@ -295,6 +295,7 @@ var | |||
| begin | |||
| TableName := MakeTTTableName('n', 'a', 'm', 'e'); | |||
| BufferSize := 0; | |||
| if GetTTTableData(Stream, TableName, nil, BufferSize) then begin | |||
| GetMem(Buffer, BufferSize); | |||
| try | |||