From c644346fb06d88d7d937768b4ae822b2468d023f Mon Sep 17 00:00:00 2001 From: anavaleije Date: Thu, 10 Nov 2011 18:23:42 +0000 Subject: [PATCH] git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2122 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- applications/fpbrowser/fpbrowser.lpi | 6 +--- applications/fpbrowser/mod_braille.pas | 40 +++++++++++++------------- applications/fpbrowser/pageloader.pas | 3 ++ 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/applications/fpbrowser/fpbrowser.lpi b/applications/fpbrowser/fpbrowser.lpi index e7f6a77c6..75b9cbe0b 100644 --- a/applications/fpbrowser/fpbrowser.lpi +++ b/applications/fpbrowser/fpbrowser.lpi @@ -112,7 +112,7 @@ - + @@ -135,10 +135,6 @@ - - - - diff --git a/applications/fpbrowser/mod_braille.pas b/applications/fpbrowser/mod_braille.pas index 9bbad0007..ba5d6a6cc 100644 --- a/applications/fpbrowser/mod_braille.pas +++ b/applications/fpbrowser/mod_braille.pas @@ -31,40 +31,40 @@ function ConvertUTF8HtmlTextToBraille(AInput: string): string; implementation type - dictionary = array[1..33] of string; + dictionary = array[1..32] of string; const number_signal = chr($e2) + chr($a0) + chr($bc); caps_signal = chr($e2) + chr($a0) + chr($a8); - d1: dictionary = ({} 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($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($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), {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), {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), {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), - {y} chr($bd), {z} chr($b5), '', '', '', '', '', '', ''); + {y} chr($bd), {z} chr($b5), '', '', '', '', '', ''); d3: dictionary = ({a + grave} chr($ab), {a + acute} chr($b7), - {a + circumflex} chr($a1), {a + tilde} chr($9c), {a + diaeresis} 'TODO', - {a + ring above} 'TODO', {ae} 'TODO', {c + cedilla} chr($af), + {a + circumflex} chr($a1), {a + tilde} chr($9c), {a + diaeresis TODO} chr($80), + {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 + diaeresis} 'TODO', {i + grave} chr($a9), {i + acute} chr($8c), - {i + circumflex} 'TODO', {i + diaeresis} chr($bb), {eth} 'TODO', - {n + tilde} 'TODO', {o + grave} chr($ba), {o + acute} chr($ac), - {o + circumflex} chr($b9), {o + tilde} chr($aa), {o + diaeresis} 'TODO', - {division sign} 'TODO', {o + stroke} 'TODO', {u + grave} chr($b1), - {u + acute} chr($be), {u + circumflex} 'TODO', {u + diaeresis} chr($b3), - {y + acute} 'TODO', {thorn} 'TODO', {y + diaeresis} 'TODO', ''); + {e + diaeresis TODO} chr($80), {i + grave} chr($a9), {i + acute} chr($8c), + {i + circumflex TODO} chr($80), {i + diaeresis} chr($bb), {eth TODO} chr($80), + {n + tilde TODO} chr($80), {o + grave} chr($ba), {o + acute} chr($ac), + {o + circumflex} chr($b9), {o + tilde} chr($aa), {o + diaeresis TODO} chr($80), + {division sign TODO} chr($80), {o + stroke TODO} chr($80), {u + grave} chr($b1), + {u + acute} chr($be), {u + circumflex TODO} chr($80), {u + diaeresis} chr($b3), + {y + acute TODO} chr($80), {thorn TODO} chr($80), {y + diaeresis TODO} chr($80)); function ConvertUTF8TextToBraille(Line: string): string; var @@ -72,15 +72,12 @@ var Braille_string: string; Pline: Pchar; num, caps: boolean; - f: TextFile; begin Braille_string := ''; num := False; caps := False; count := 1; - AssignFile(f, 'test'); - Rewrite(f); if Line = '' then Result := ''; len := length(Line); @@ -101,6 +98,9 @@ begin else if (n = 10) then Braille_string := Braille_string + #10 + else + if (n = 32) then Braille_string := Braille_string + #32 + else begin @@ -125,7 +125,7 @@ begin 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 begin next_n := Ord(Line[count + 1]); @@ -151,9 +151,9 @@ begin else 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 - 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 begin next_n := Ord(Line[count + 1]); @@ -208,7 +208,6 @@ begin count := count + lCharSize; Inc(Pline, lCharSize); end; - Close(f); Result := Braille_string; end; @@ -302,6 +301,7 @@ function TBrailleBrowserModule.HandleOnPageLoad(AInput: string; out AOutput: string): Boolean; begin AOutput := ConvertUTF8HtmlTextToBraille(AInput); + Result := True; end; initialization diff --git a/applications/fpbrowser/pageloader.pas b/applications/fpbrowser/pageloader.pas index aad3437c9..9b2c9e141 100644 --- a/applications/fpbrowser/pageloader.pas +++ b/applications/fpbrowser/pageloader.pas @@ -68,7 +68,10 @@ begin lModule := GetBrowserModule(i); if not lModule.Activated then Continue; if lModule.HandleOnPageLoad(PageLoader.Contents, lNewContents) then + begin PageLoader.Contents := lNewContents; + writeln(PageLoader.Contents); + end; end; end;