Browse Source

initial commit

Tobias Diekershoff 6 years ago
54 changed files with 179682 additions and 0 deletions
  1. +50
  2. +169
  3. +425
  4. +1735
  5. +1052
  6. +3719
  7. +6824
  8. +1250
  9. +14576
  10. +599
  11. +1114
  12. +8628
  13. +5022
  14. +3051
  15. +3803
  16. +268
  17. +396
  18. +1279
  19. +6212
  20. +2383
  21. +3097
  22. +1578
  23. +13505
  24. +771
  25. +333
  26. +4299
  27. +518
  28. +545
  29. +1615
  30. +663
  31. +27307
  32. +4194
  33. +426
  34. +789
  35. +5104
  36. +697
  37. +2857
  38. +2875
  39. +2586
  40. +1193
  41. +2665
  42. +4835
  43. +659
  44. +2092
  45. +309
  46. +252
  47. +27303
  48. +63
  49. +37
  50. +1166
  51. +511
  52. +25
  53. +2196
  54. +62

+ 50
- 0 View File

@ -0,0 +1,50 @@
Typography Addon
This addpn uses the [php typography](
library by KINGdesk to enhance the typography of postings in friendica.
The addon uses the language detection capabilities of friendica to select the
approproate typographic set or rules.
* write some CSS to enhance the typography of stuff like ALL CAPS etc. a bit
further, now that they are identified and marked.
* There was one thing in the library that I had to comment out to get rid of
many warnings (see php-typography.php lines 1964 and following) which should
be fixed in a better way.s
* 2014-12-29: Version 0.1, initial release
* [Tobias Diekershoff](
This addon is licensed under the terms of the [GNU GPL 2.0](
as the underlying library uses this license.
Copyright (C) 2014 Tobias Diekershoff
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.

+ 169
- 0
php-typography/change_log-php.txt View File

@ -0,0 +1,169 @@
1.21 - December 31, 2009
Fixed bug in custom diacritic handling
1.20 - December 20, 2009
Resolved uninitiated variable
Added HTML5 elements to parsing algorithm for greater contextual awareness
Updated to PHP Parser 1.20
1.19 - December 1, 2009
Fixed bug where dewidow functionality would add broken no-break spaces to the end of texts, and smart_exponents would drop some of the resulting text.
Declared encoding in all instances of mb_substr to avoid conflicts
Corrected a few instances of undeclared variables.
Updated to PHP Parser 1.19
1.18 - November 10, 2009
Added Norwegian Hyphenation Patterns
1.17 - November 9, 2009
Fixed bug in diacritic handling
1.16 - November 4, 2009
Added US English list of all words containing diacritics to `/diacritics/en-US.php`
Added get_diacritic_languages() method
Added set_smart_diacritics() method
Added set_diacritic_language() method
Added set_diacritic_custom_replacements() method
Added smart_diacritics() method
Improved smart quotes and dashes to be sensitive to adjacent diacritic characters.
1.15 - October 21, 2009
Depreciated set_smart_quotes_language()
Added set_smart_quotes_primary()
Added set_smart_quotes_secondary()
1.14 - September 8, 2009
Improved space_collapse method
Corrected bug in smart quote and single character word handling where the "0" character may be improperly duplicated
1.13 - August 31, 2009
Added set_space_collapse and space_collapse methods
1.12 - August 17, 2009
Corrected multibyte character error that caused set_single_character_word_spacing() to drop words under rare circumstances
1.11 - August 14, 2009
Added language specific quote handling (for single quotes, not just double) for English, German and French quotation styles
1.10 - August 14, 2009
Added set_smart_quotes_language() for unique handling of English, German and French quotation styles
Corrected multibyte character error that caused set_single_character_word_spacing() to drop words under rare circumstances
Expanded the multibyte character set recognized as valid word characters for improved hyphenation
Updated to PHP Parser 1.10
1.9 - August 12, 2009
Added option to force single character words to wrap to new line (unless they are widows).
Fixed bug where hyphenation pattern settings were not initialized with multiple phpTypography class instances.
1.8 - August 4, 2009
Fixed date handling in smart_math() and smart_dashes() methods
Fixed style_caps() method to be friendly with soft-hyphens
1.7 - July 28, 2009
Reformatted language files with line returns after each key=>value pair in an array
1.6 - July 28, 2009
Efficiency Optimizations ( approximately 25% speed increase ) Thanks Jenny!
1.5 - July 27, 2009
Added the set_hyphenate_title_case() method to exclude hyphenation of capitalized (title case) words to help protect proper nouns
Added Hungarian Hyphenation Pattern
1.4 - July 23, 2009
Updated to PHP Parser 1.4 (fixed a hyphenation problem where pre-hyphenated words were processed again)
1.3 - July 23, 2009
Uninitialized variables corrected throughout.
Use of 2 instances of create_function() eliminated for performance gain
Cleaned up HTML character handling in process_feed(). No errors were identified prior to edit, but now it is consistent with how process() works.
1.2 - July 23, 2009
moved the processing of widow handling after hyphenation so that max-pull would not be compared to the length of the adjacent word, but rather the length of the adjacent word segment (i.e. that after a soft hyphen)
1.1 - July 22, 2009
By default, when class phpTypography is constructed, set_defaults is called. However, if you are going to manually set all settings, you can now bypass the set_defaults call for slightly improved performance. Just call `$typo = new phpTypography(FALSE)`
Added `html_entity_decode` to process_feed to avoid invalid character injection (according to XML's specs)
1.0.3 - July 17, 2009 =
Reverted use of the hyphen character to the basic minus-hyphen in words like "mother-in-law" because of poor support in IE6
1.0.2 - July 16, 2009
Corrected smart_math to not convert slashes in URLs to division signs
1.0 - July 15, 2009
Added test to phpTypography methods process() and process_feed() to skip processing if $isTitle parameter is TRUE and h1 or h2 is an excluded HTML tag
1.0 beta 9 - July 14, 2009
added catch-all quote handling, now any quotes that escape previous filters will be assumed to be closing quotes
1.0 beta 8 - July 13, 2009
Changed thin space injection behavior so that for text such as "...often-always?-judging...", the second dash will be wrapped in thin spaces
Corrected error where fractions were not being styled because of a zero-space insertion with the wrap hard hyphens functionality
Added default class to exclude: "noTypo"
1.0 beta 7 - July 10, 2009
added "/" as a valid word character so we could capture "this/that" as a word for processing (similar to "mother-in-law")
Corrected error where characters from the Latin 1 Supplement Block were not recognized as word characters
Corrected smart quote handling for strings of numbers
Added smart guillemet conversion as part of smart quotes: << and >> to « and »
Added smart Single Low 9 Quote conversion as part of smart quotes: comma followed by non-space becomes Single Low 9 Quote
Added Single Low 9 Quote, Double Low 9 Quote and » to style_initial_character functionality
Added a new phpTypography method smart_math that assigns proper characters to minus, multiplication and division characters
Depreciated the phpTypography method smart_multiplication in favor of smart_math
Cleaned up some smart quote functionality
Added ability to wrap after "/" if set_wrap_hard_hyphen is TRUE (like "this/that")
1.0 beta 6 - July 9, 2009
Critical bug fix: RSS feeds were being disabled by previous versions. This has been corrected.
1.0 beta 5 - July 8, 2009
corrected error where requiring Em/En dash thin spacing "word-" would become "word –" instead of "word–"
1.0 beta 4 - July 7, 2009
Added default encoding value to smart_quote handling to avoid PHP warning messages
1.0 beta 3 - July 6, 2009
corrected curling quotes at the end of block level elements
1.0 beta 2 - July 6, 2009
corrected multibyte character conflict in smart-quote handling that caused infrequent dropping of text
thin space injection included for en-dashes
1.0 beta 1 - July 3, 2009
initial release

+ 425
- 0
php-typography/diacritics/en-US.php View File

@ -0,0 +1,425 @@
* Language: English (United States)
* An array of all words containing diacritics (and their non-diacritic
* alternatives that should be replaced), provided a legitimate English
* word does not exist without such diacritic characters (i.e.
* divorcé & divorce, exposé & expose, résumé & resume ).
* In the form of $diacriticWords = array( key => value );
* where "key" is the needle and "value" is the replacement
$diacriticLanguage = 'English (United States)';
$diacriticWords = array(
"a bas"=>"à bas",
"A bas"=>"À bas",
"a la"=>"à la",
"A la"=>"À la",
"a la carte"=>"à la carte",
"A la carte"=>"À la carte",
"a la mode"=>"à la mode",
"A la mode"=>"À la mode",
"a gogo"=>"à gogo",
"A gogo"=>"À gogo",
"Ancien Regime"=>"Ancien Régime",
"ao dai"=>"áo dài",
"Ao dai"=>"Áo dài",
"belle epoque"=>"belle époque",
"Belle epoque"=>"Belle époque",
"bete noire"=>"bête noire",
"Bete noire"=>"Bête noire",
"charge d'affaires"=>"chargé d'affaires",
"Charge d'affaires"=>"Chargé d'affaires",
"cause celebre"=>"cause célèbre",
"Cause celebre"=>"Cause célèbre",
"cinema verite"=>"cinéma vérité",
"Cinema verite"=>"Cinéma vérité",
"coup d'etat"=>"coup d'état",
"Coup d'etat"=>"Coup d'état",
"coup de grace"=>"coup de grâce",
"Coup de grace"=>"Coup de grâce",
"creme brulee"=>"crème brûlée",
"Creme brulee"=>"Crème brûlée",
"creme fraiche"=>"crème fraîche",
"Creme fraiche"=>"Crème fraîche",
"dau hoi"=>"dấu hỏi",
"Dau hoi"=>"Dấu hỏi",
"deja vu"=>"déjà vu",
"Deja vu"=>"Déjà vu",
"El Nino"=>"El Niño",
"fin de siecle"=>"fin de siècle",
"Fin de siecle"=>"Fin de siècle",
"fohn wind"=>"föhn wind",
"Fohn wind"=>"Föhn wind",
"folie a deux"=>"folie à deux",
"Folie a deux"=>"Folie à deux",
"Grafenberg spot"=>"Gräfenberg spot",
"hors d’oeuvre"=>"hors d’œuvre",
"Hors d’oeuvre"=>"Hors d’œuvre",
"langue d'oil"=>"langue d'oïl",
"Langue d'oil"=>"Langue d'oïl",
"La Nina"=>"La Niña",
"maitre d'hotel"=>"maître d'hôtel",
"Maitre d'hotel"=>"Maître d'hôtel",
"menage a trois"=>"ménage à trois",
"Menage a trois"=>"Ménage à trois",
"Nez Perce"=>"Nez Percé",
"numero uno"=>"número uno",
"Numero uno"=>"Número uno",
"objet trouve"=>"objet trouvé",
"Objet trouve"=>"Objet trouvé",
"opera bouffe"=>"opéra bouffe",
"Opera bouffe"=>"Opéra bouffe",
"opera comique"=>"opéra comique",
"Opera comique"=>"Opéra comique",
"piece de resistance"=>"pièce de résistance",
"Piece de resistance"=>"Pièce de résistance",
"pina colada"=>"piña colada",
"Pina colada"=>"Piña colada",
"raison d'etre"=>"raison d'être",
"Raison d'etre"=>"Raison d'être",
"roman a clef"=>"roman à clef",
"Roman a clef"=>"Roman à clef",
"Sinn Fein"=>"Sinn Féin",

+ 1735
- 0
File diff suppressed because it is too large
View File

+ 1052
- 0
File diff suppressed because it is too large
View File

+ 3719
- 0
File diff suppressed because it is too large
View File

+ 6824
- 0
File diff suppressed because it is too large
View File

+ 1250
- 0
File diff suppressed because it is too large
View File

+ 14576
- 0
File diff suppressed because it is too large
View File

+ 599
- 0
php-typography/lang/el-Mono.php View File

@ -0,0 +1,599 @@
Project: PHP Typography
Project URI:
File modified to place pattern and exceptions in arrays that can be understood in php files.
This file is released under the same copyright as the below referenced original file
Original unmodified file is available at:
Original file name: hyph-el-monoton.tex
% ****************************************************************
% File name: grmhyph5-unicode.tex
% This file was first created by mechanical translation from
% GRMhyph5.tex via 'elhyph-utf8 -m -c' (version 0.1 by Peter
% Heslin -- Some additions were
% also made by hand.
% Created: June 6, 2008
% Hyphenation patterns for Modern Monotonic Greek.
% Created by Dimitrios Filippou with some ideas borrowed from
% Yannis Haralambous, Kostis Dryllerakis and Claudio Beccari.
% These hyphenation patterns are explained in 'ancient.pdf'.
% Hyphenation examples are given in the file 'anc-test.pdf'.
% Some doubtful patterns are marked by three question marks '???'.
% Documentation in English can be found in: D. Filippou,
% 'Hyphenation patterns for Ancient and Modern Greek, ' in
% 'TeX, XML, and Digital Typography' (A. Syropoulos et al.,
% eds.), Lecture Notes in Computer Science 3130, Springer-Verlag
% Berlin-Heidelberg, 2004. ISBN 3-540-22801-2.
% ****************************************************************
% \message{UTF-8 hyphenation patterns for Modern, Monotonic Greek}
$patgenLanguage = 'Greek (Modern Monotonic)';
$patgenExceptions = array();
$patgenMaxSeg = 4;
$patgen = array(

+ 1114
- 0
File diff suppressed because it is too large
View File

+ 8628
- 0
File diff suppressed because it is too large
View File

+ 5022
- 0
File diff suppressed because it is too large
View File

+ 3051
- 0
File diff suppressed because it is too large
View File

+ 3803
- 0
File diff suppressed because it is too large
View File

+ 268
- 0
php-typography/lang/eu.php View File

@ -0,0 +1,268 @@
Project: PHP Typography
Project URI:
File modified to place pattern and exceptions in arrays that can be understood in php files.
This file is released under the same copyright as the below referenced original file
Original unmodified file is available at:
Original file name: hyph-eu.tex
% Hyphenation patterns for Basque.
% This file has first been written by Juan M. Aguirregabiria
% ( on February 1997 based on the
% script that generates the Spanish patterns as compiled
% by Julio Sanchez ( on September 1991.
% In June 2008 the generating script has been rewritten into ruby and
% adapted for native UTF-8 TeX engines. Patterns became part of hyph-utf8
% package and were renamed from bahyph.tex into hyph-eu.tex.
% Functionality should not change apart from adding ñ by default.
% The original Copyright followed and applied also to precessor of this file
% whose last version will be always available by anonymous ftp
% from or by poynting your Web browser to
% For more information about the new UTF-8 hyphenation patterns and
% links to this file see
% These patterns and the generating script are Copyright (c) JMA 1997, 2008
% These patterns are made public in the hope that they will benefit others.
% You can use this software for any purpose.
% However, this is given for free and WITHOUT ANY WARRANTY.
% You are kindly requested to send any changes to the author.
% If you change the generating script, you must include code
% in it such that any output is clearly labeled as generated
% by a modified script.
% Open vowels: a e o
% Closed vowels: i u
% Consonants: b c d f g j k l m n ñ p q r s t v w x y z
% Some of the patterns below represent combinations that never
% happen in Basque. Would they happen, they would be hyphenated
% according to the rules.
$patgenLanguage = 'Basque';
$patgenExceptions = array();
$patgenMaxSeg = 4;
$patgen = array(

+ 396
- 0
php-typography/lang/fi.php View File

@ -0,0 +1,396 @@
Project: PHP Typography
Project URI:
File modified to place pattern and exceptions in arrays that can be understood in php files.
This file is released under the same copyright as the below referenced original file
Original unmodified file is available at:
Original file name: hyph-_______________.tex
% This file is part of hyph-utf8 package and resulted from
% semi-manual conversions of hyphenation patterns into UTF-8 in June 2008.
% Source: fihyph.tex (yyyy-mm-dd)
% Author: Kauko Saarinen
% The above mentioned file should become obsolete,
% and the author of the original file should preferaby modify this file instead.
% Modificatios were needed in order to support native UTF-8 engines,
% but functionality (hopefully) didn't change in any way, at least not intentionally.
% This file is no longer stand-alone; at least for 8-bit engines
% you probably want to use loadhyph-foo.tex (which will load this file) instead.
% Modifications were done by Jonathan Kew, Mojca Miklavec & Arthur Reutenauer
% with help & support from:
% - Karl Berry, who gave us free hands and all resources
% - Taco Hoekwater, with useful macros
% - Hans Hagen, who did the unicodifisation of patterns already long before
% and helped with testing, suggestions and bug reports
% - Norbert Preining, who tested & integrated patterns into TeX Live
% However, the 'copyright/copyleft' owner of patterns remains the original author.
% The copyright statement of this file is thus:
% Do with this file whatever needs to be done in future for the sake of
% 'a better world' as long as you respect the copyright of original file.
% If you're the original author of patterns or taking over a new revolution,
% plese remove all of the TUG comments & credits that we added here -
% you are the Queen / the King, we are only the servants.
% If you want to change this file, rather than uploading directly to CTAN,
% we would be grateful if you could send it to us (
% or ask for credentials for SVN repository and commit it yourself;
% we will then upload the whole 'package' to CTAN.
% Before a new 'pattern-revolution' starts,
% please try to follow some guidelines if possible:
% - \lccode is *forbidden*, and I really mean it
% - all the patterns should be in UTF-8
% - the only 'allowed' TeX commands in this file are: \patterns, \hyphenation,
% and if you really cannot do without, also \input and \message
% - in particular, please no \catcode or \lccode changes,
% they belong to loadhyph-foo.tex,
% and no \lefthyphenmin and \righthyphenmin,
% they have no influence here and belong elsewhere
% - \begingroup and/or \endinput is not needed
% - feel free to do whatever you want inside comments
% We know that TeX is extremely powerful, but give a stupid parser
% at least a chance to read your patterns.
% For more unformation see
% -----> Finnish hyphenation patterns for MLPCTeX <------
% First release January -86 by Kauko Saarinen,
% Computing Centre, University of Jyvaskyla, Finland
% Completely rewritten January -88. The new patterns make
% much less mistakes with foreign and compound words.
% The article 'Automatic Hyphenation of Finnish'
% by Professor Fred Karlsson is also referred
% ---------------------------------------------------------
% 8th March -89 (vers. 2.2), some vowel triples by Fred Karlsson added.
% 9th January - 95: added \uccode and \lccode by Thomas Esser
% ********* Patterns may be freely distributed **********