git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2122 8e941d3f-bd1b-0410-a28a-d453659cc2b4

This commit is contained in:
anavaleije 2011-11-10 18:23:42 +00:00
parent 8af01c60d2
commit c644346fb0
3 changed files with 24 additions and 25 deletions

View File

@ -112,7 +112,7 @@
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="10"/> <Version Value="11"/>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="../../components/thtmlport/package"/> <OtherUnitFiles Value="../../components/thtmlport/package"/>
</SearchPaths> </SearchPaths>
@ -135,10 +135,6 @@
</Checks> </Checks>
</CodeGeneration> </CodeGeneration>
<Linking> <Linking>
<Debugging>
<GenerateDebugInfo Value="True"/>
<DebugInfoType Value="dsAuto"/>
</Debugging>
<Options> <Options>
<Win32> <Win32>
<GraphicApplication Value="True"/> <GraphicApplication Value="True"/>

View File

@ -31,40 +31,40 @@ function ConvertUTF8HtmlTextToBraille(AInput: string): string;
implementation implementation
type type
dictionary = array[1..33] of string; dictionary = array[1..32] of string;
const const
number_signal = chr($e2) + chr($a0) + chr($bc); number_signal = chr($e2) + chr($a0) + chr($bc);
caps_signal = chr($e2) + chr($a0) + chr($a8); caps_signal = chr($e2) + chr($a0) + chr($a8);
d1: dictionary = ({<space>} chr($80), {!} chr($96), {"} chr($a6), {#} 'TODO', {(*$*)} chr($b0), d1: dictionary = ({!} chr($96), {"} chr($a6), {# TODO} chr($80), {(*$*)} chr($b0),
{%} chr($b8) + chr($e2) + chr($a0) + chr($b4), {&} chr($af), {'} chr($84), {%} chr($b8) + chr($e2) + chr($a0) + chr($b4), {&} chr($af), {'} chr($84),
{(} chr($a3) + chr($e2) + chr($a0) + chr($84), {)} chr($a0) + chr($e2) + chr($a0) + chr($9c), {(} chr($a3) + chr($e2) + chr($a0) + chr($84), {)} chr($a0) + chr($e2) + chr($a0) + chr($9c),
{*} chr($94), {+} chr($96), {,} chr($82), {-} chr($a4), {.} chr($84), {*} chr($94), {+} chr($96), {,} chr($82), {-} chr($a4), {.} chr($84),
{/} chr($90) + chr($e2) + chr($a0) + chr($b2), {0} chr($9a), {1} chr($81), {/} chr($90) + chr($e2) + chr($a0) + chr($b2), {0} chr($9a), {1} chr($81),
{2} chr($83), {3} chr($89), {4} chr($99), {5} chr($91), {6} chr($8b), {2} chr($83), {3} chr($89), {4} chr($99), {5} chr($91), {6} chr($8b),
{7} chr($9b), {8} chr($93), {9} chr($8a), {:} chr($92), {;} chr($86), {7} chr($9b), {8} chr($93), {9} chr($8a), {:} chr($92), {;} chr($86),
{<} chr($aa), {=} chr($b6), {>} chr($95), {?} chr($a2), {@} 'TODO'); {<} chr($aa), {=} chr($b6), {>} chr($95), {?} chr($a2), {@ TODO} chr($80));
d2: dictionary = ({a} chr($81), {b} chr($83), {c} chr($89), {d} chr($99), d2: dictionary = ({a} chr($81), {b} chr($83), {c} chr($89), {d} chr($99),
{e} chr($91), {f} chr($8b), {g} chr($9b), {h} chr($93), {i} chr($8a), {e} chr($91), {f} chr($8b), {g} chr($9b), {h} chr($93), {i} chr($8a),
{j} chr($9a), {k} chr($85), {l} chr($87), {m} chr($8d), {n} chr($9d), {j} chr($9a), {k} chr($85), {l} chr($87), {m} chr($8d), {n} chr($9d),
{o} chr($95), {p} chr($8f), {q} chr($9f), {r} chr($97), {s} chr($8e), {o} chr($95), {p} chr($8f), {q} chr($9f), {r} chr($97), {s} chr($8e),
{t} chr($9e), {u} chr($a5), {v} chr($a7), {w} chr($ba), {x} chr($ad), {t} chr($9e), {u} chr($a5), {v} chr($a7), {w} chr($ba), {x} chr($ad),
{y} chr($bd), {z} chr($b5), '', '', '', '', '', '', ''); {y} chr($bd), {z} chr($b5), '', '', '', '', '', '');
d3: dictionary = ({a + grave} chr($ab), {a + acute} chr($b7), d3: dictionary = ({a + grave} chr($ab), {a + acute} chr($b7),
{a + circumflex} chr($a1), {a + tilde} chr($9c), {a + diaeresis} 'TODO', {a + circumflex} chr($a1), {a + tilde} chr($9c), {a + diaeresis TODO} chr($80),
{a + ring above} 'TODO', {ae} 'TODO', {c + cedilla} chr($af), {a + ring above TODO} chr($80), {ae TODO} chr($80), {c + cedilla} chr($af),
{e + grave} chr($ae), {e + acute} chr($bf), {e + circumflex} chr($a3), {e + grave} chr($ae), {e + acute} chr($bf), {e + circumflex} chr($a3),
{e + diaeresis} 'TODO', {i + grave} chr($a9), {i + acute} chr($8c), {e + diaeresis TODO} chr($80), {i + grave} chr($a9), {i + acute} chr($8c),
{i + circumflex} 'TODO', {i + diaeresis} chr($bb), {eth} 'TODO', {i + circumflex TODO} chr($80), {i + diaeresis} chr($bb), {eth TODO} chr($80),
{n + tilde} 'TODO', {o + grave} chr($ba), {o + acute} chr($ac), {n + tilde TODO} chr($80), {o + grave} chr($ba), {o + acute} chr($ac),
{o + circumflex} chr($b9), {o + tilde} chr($aa), {o + diaeresis} 'TODO', {o + circumflex} chr($b9), {o + tilde} chr($aa), {o + diaeresis TODO} chr($80),
{division sign} 'TODO', {o + stroke} 'TODO', {u + grave} chr($b1), {division sign TODO} chr($80), {o + stroke TODO} chr($80), {u + grave} chr($b1),
{u + acute} chr($be), {u + circumflex} 'TODO', {u + diaeresis} chr($b3), {u + acute} chr($be), {u + circumflex TODO} chr($80), {u + diaeresis} chr($b3),
{y + acute} 'TODO', {thorn} 'TODO', {y + diaeresis} 'TODO', ''); {y + acute TODO} chr($80), {thorn TODO} chr($80), {y + diaeresis TODO} chr($80));
function ConvertUTF8TextToBraille(Line: string): string; function ConvertUTF8TextToBraille(Line: string): string;
var var
@ -72,15 +72,12 @@ var
Braille_string: string; Braille_string: string;
Pline: Pchar; Pline: Pchar;
num, caps: boolean; num, caps: boolean;
f: TextFile;
begin begin
Braille_string := ''; Braille_string := '';
num := False; num := False;
caps := False; caps := False;
count := 1; count := 1;
AssignFile(f, 'test');
Rewrite(f);
if Line = '' then Result := ''; if Line = '' then Result := '';
len := length(Line); len := length(Line);
@ -101,6 +98,9 @@ begin
else else
if (n = 10) then Braille_string := Braille_string + #10 if (n = 10) then Braille_string := Braille_string + #10
else
if (n = 32) then Braille_string := Braille_string + #32
else else
begin begin
@ -125,7 +125,7 @@ begin
end; end;
end; end;
end; end;
Braille_string := Braille_string + chr($e2) + chr($a0) + d1[n - 31]; Braille_string := Braille_string + chr($e2) + chr($a0) + d2[n - 64];
if (count + 1 <= length(Line)) then if (count + 1 <= length(Line)) then
begin begin
next_n := Ord(Line[count + 1]); next_n := Ord(Line[count + 1]);
@ -151,9 +151,9 @@ begin
else else
begin begin
if (n >= 32) and (n <= 64) then {a char from the first dictionary} if (n >= 33) and (n <= 64) then {a char from the first dictionary}
begin begin
Braille_string := Braille_string + chr($e2) + chr($a0) + d1[n - 31]; Braille_string := Braille_string + chr($e2) + chr($a0) + d1[n - 32];
if (count + 1 <= length(Line)) then if (count + 1 <= length(Line)) then
begin begin
next_n := Ord(Line[count + 1]); next_n := Ord(Line[count + 1]);
@ -208,7 +208,6 @@ begin
count := count + lCharSize; count := count + lCharSize;
Inc(Pline, lCharSize); Inc(Pline, lCharSize);
end; end;
Close(f);
Result := Braille_string; Result := Braille_string;
end; end;
@ -302,6 +301,7 @@ function TBrailleBrowserModule.HandleOnPageLoad(AInput: string; out
AOutput: string): Boolean; AOutput: string): Boolean;
begin begin
AOutput := ConvertUTF8HtmlTextToBraille(AInput); AOutput := ConvertUTF8HtmlTextToBraille(AInput);
Result := True;
end; end;
initialization initialization

View File

@ -68,7 +68,10 @@ begin
lModule := GetBrowserModule(i); lModule := GetBrowserModule(i);
if not lModule.Activated then Continue; if not lModule.Activated then Continue;
if lModule.HandleOnPageLoad(PageLoader.Contents, lNewContents) then if lModule.HandleOnPageLoad(PageLoader.Contents, lNewContents) then
begin
PageLoader.Contents := lNewContents; PageLoader.Contents := lNewContents;
writeln(PageLoader.Contents);
end;
end; end;
end; end;