Friendica addon for a more typographically correct rendering of the postings depending on the used language in the posting.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.6 KiB

* Name: Typography
* Description: Applies typographical enhancements to the postings before displaying them
* Version: 0.3
* Author: Tobias Diekershoff <>
* License: GPL 2.0
use Friendica\DI;
use Friendica\Core\PConfig;
use Friendica\Core\Addon;
function typography_install () {
Addon::registerHook ('prepare_body', 'addon/typography/typography.php', 'typography_render' );
function typography_uninstall () {
Addon::unregisterHook ('prepare_body', 'addon/typography/typography.php', 'typography_render' );
function typography_render ( &$a, &$o) {
$typo = new phpTypography();
$lng_id = array(
$lng_long = array(
$l = new Text_LanguageDetect;
$lng = $l->detectSimple($o['html']);
$lng = str_replace( $lng_long, $lng_id, $lng);
$o['html'] = $typo->process($o['html']);
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . DI::baseUrl()->get() . '/addon/typography/style.css' . '" media="all" />';