mORMot and Open Source friends
Check-in [87a1242747]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:tried to fix access violation with some kind of fonts
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 87a1242747caebac8ac629ba5d2eb5e1317d6db8
User & Date: G018869 2012-07-11 05:51:29
Context
2012-07-11
06:14
now JSON parser will allow whitespace inserted between any pair of tokens, even after true/false/null, as expected by the specification - fix ticket [db2d4aed31] check-in: c8f19233cf user: G018869 tags: trunk
05:51
tried to fix access violation with some kind of fonts check-in: 87a1242747 user: G018869 tags: trunk
05:15
moved logging threadvars and associated structures into hidden internal declaration (i.e. implementation section), for better work with packages (avoid W1032 warning) check-in: 1080b93549 user: G018869 tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to SynPdf.pas.

7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
....
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098

7099
7100
7101

7102
7103
7104

7105



7106
7107
7108
7109
7110
7111
7112
var P: pointer;
    SubTable: ^TCmapSubTableArray absolute P;
    Header: ^TCmapHeader;
    i, n, code, ndx: PtrInt;
    off: cardinal;
    glyphIndex: integer;
    idDeltai, glyphi: PtrInt;
    W: word;
    fUnitsPerEmShr: cardinal;
begin
  // retrieve the 'cmap' (character code mapping) table
  // see http://developer.apple.com/fonts/TTRefMan/RM06/Chap6cmap.html
  // and http://www.microsoft.com/typography/OTSPEC/cmap.htm
  P := GetTTFData(aUnicodeTTF.fDoc.FDC,'cmap',fcmap);
  if P=nil then
................................................................................
  // (from http://www.microsoft.com/typography/OTSPEC/head.htm)
  fUnitsPerEmShr := 0; // fastest integer div for width calculating
  for i := 14 downto 4 do
    if GetBit(head^.UnitsPerEm,i) then begin
      fUnitsPerEmShr := i;
      break;
    end;
  if fUnitsPerEmShr<>0 then
    if aUnicodeTTF.FixedWidth then begin
      W := (cardinal(fhmtx[0])*1000) shr fUnitsPerEmShr;

      for i := 0 to aUnicodeTTF.fUsedWideChar.Count-1 do
        aUnicodeTTF.fUsedWide[i].Width := W;
    end else

    for i := 0 to aUnicodeTTF.fUsedWideChar.Count-1 do
    with aUnicodeTTF.fUsedWide[i] do
      if Glyph<>0 then

        Width := (cardinal(fhmtx[Glyph*2])*1000) shr fUnitsPerEmShr;



end;


{ TPdfPage }

constructor TPdfPage.Create(ADoc: TPdfDocument);
begin






|







 







|
<
|
>

|
|
>
|
|
|
>
|
>
>
>







7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
....
7089
7090
7091
7092
7093
7094
7095
7096

7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
var P: pointer;
    SubTable: ^TCmapSubTableArray absolute P;
    Header: ^TCmapHeader;
    i, n, code, ndx: PtrInt;
    off: cardinal;
    glyphIndex: integer;
    idDeltai, glyphi: PtrInt;
    W, numOfLongHorMetrics: word;
    fUnitsPerEmShr: cardinal;
begin
  // retrieve the 'cmap' (character code mapping) table
  // see http://developer.apple.com/fonts/TTRefMan/RM06/Chap6cmap.html
  // and http://www.microsoft.com/typography/OTSPEC/cmap.htm
  P := GetTTFData(aUnicodeTTF.fDoc.FDC,'cmap',fcmap);
  if P=nil then
................................................................................
  // (from http://www.microsoft.com/typography/OTSPEC/head.htm)
  fUnitsPerEmShr := 0; // fastest integer div for width calculating
  for i := 14 downto 4 do
    if GetBit(head^.UnitsPerEm,i) then begin
      fUnitsPerEmShr := i;
      break;
    end;
  if fUnitsPerEmShr<>0 then begin

    W := (cardinal(fhmtx[0])*1000) shr fUnitsPerEmShr;
    if aUnicodeTTF.FixedWidth then
      for i := 0 to aUnicodeTTF.fUsedWideChar.Count-1 do
        aUnicodeTTF.fUsedWide[i].Width := W
    else begin
      numOfLongHorMetrics := fhhea[17];
      for i := 0 to aUnicodeTTF.fUsedWideChar.Count-1 do
      with aUnicodeTTF.fUsedWide[i] do
        if Glyph<>0 then
          if Glyph<=numOfLongHorMetrics then
            Width := (cardinal(fhmtx[Glyph*2])*1000) shr fUnitsPerEmShr else
            Width := W;
    end;
  end;
end;


{ TPdfPage }

constructor TPdfPage.Create(ADoc: TPdfDocument);
begin