DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:fontfamily

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:fontfamily [2012-08-06 00:12] 77.34.99.12plugin:fontfamily [2023-12-16 18:49] (current) Aleksandr
Line 1: Line 1:
-====== fontfamily plugin ======+====== FontFamily Plugin ======
  
 ---- plugin ---- ---- plugin ----
Line 6: Line 6:
 email      : thorsten.stratmann@web.de email      : thorsten.stratmann@web.de
 type       : syntax type       : syntax
-lastupdate : 2012-08-03 +lastupdate : 2019-03-19 
-compatible : Anteater, Rincewind at least+compatible : Anteater, Rincewind, Angua, Adora Belle, Weatherwax, Binky, Ponder Stibbons, Greebo
 depends    :  depends    : 
 conflicts  conflicts 
Line 13: Line 13:
 tags       : typography tags       : typography
  
-downloadurl: http://comicslate.org/_media/wiki/fontfamily.tgz+downloadurl: https://trello.com/1/cards/604de5942d22aa21c6c1ac36/attachments/604de5e0ebeb494d053cddc4/download/fontfamily.zip 
 +bugtracker : # https://github.com/Dr-Yukon/dokuwiki-fontfamily/issues 
 +sourcerepo : # https://github.com/Dr-Yukon/dokuwiki-fontfamily/
 ---- ----
- 
- 
-<del>Der Toolbar Button funktioniert nur bis zur DokuWiki Version 2009-12-25 ! \\ 
-Diese Plugin wird nicht weiterentwickelt !</del> 
- 
  
 ===== Download and Installation ===== ===== Download and Installation =====
  
-Download and install the plugin using the [[plugin:plugin|Plugin Manager]] using the following URL. Refer to [[:Plugins]] on how to install plugins manually.+Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
  
-  * <del>[[http://www.tstratmann.de/ftp/fontfamily.zip|fontfamily.zip]]</del> +  * ver. 2019: [[https://trello.com/1/cards/604de5942d22aa21c6c1ac36/attachments/604de5e0ebeb494d053cddc4/download/fontfamily.zip|fontfamily.zip]] 
- +  ver. 2012 (0.3): [[https://trello.com/1/cards/604de5942d22aa21c6c1ac36/attachments/604de5e5c8d3543f2cece0ca/download/fontfamily_2012-08-03.tgz|fontfamily_2012-08-03.tgz]]
-__**I made workable analogue of [[plugin:fontcolor]] and put it here [[http://comicslate.org/_media/wiki/fontfamily.tgz]]. MD5 sum d5cfa70394c9fb1a23088fa849cee8a8**__. __Fixed toolbar icon__ added iconbar triangle.+
  
 ===== Description ===== ===== Description =====
  
-Change the fontfamily by clicking a button in the edit toolbar+Select the text that you would like to change, then click on the {{https://trello.com/1/cards/604de5942d22aa21c6c1ac36/attachments/604de604430a705e9f80c9bb/download/toolbar_icon.png?16x16&recache|font family toolbar button}} and choose one of the predefined font samples in the emerged picker.
  
-To change the fontfamily , mark the text that you would like to change. +The result is: 
-Then click on the button fontfamily and choose one of the predefined styles. +  <ff fontfamily>Your own text</ff>
-The result is: <ff fontfamily> Your own text</ff>+
  
 +Code based on the [[plugin:highlight|plugin highlight]]
  
-===== Code ===== +===== Changelog =====
-code based on the [[plugin:highlight|plugin highlight]]+
  
 +  * Version 2019-03-19: Fixed image paths, cropped images, added 19 translations and CSS width fixer; <del>uploaded in GitHub</del>
 +  * Version 0.3: Fixed icon, reworked with fontsize2 example
 +  * Version 0.1: Created
  
-==== syntax.php==== +===== Bugs =====
- +
-Put this code into ''lib/plugins/fontfamily/syntax.php'': +
- +
- +
-<code php> +
-<?php +
-<?php +
-/** +
- * fontfamily Plugin: control the font-family of your text +
- * +
- * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html) +
- * @author      Thorsten Stratmann <thorsten.stratmann@web.de> +
- * @link          http://wiki.splitbrain.org/plugin:fontfamily +
- * @version    0.1 +
- */ +
-  +
-if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); +
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); +
-require_once(DOKU_PLUGIN.'syntax.php'); +
-  +
-/** +
- * All DokuWiki plugins to extend the parser/rendering mechanism +
- * need to inherit from this class +
- */ +
-class syntax_plugin_fontfamily extends DokuWiki_Syntax_Plugin { +
-  +
-    function getInfo(){  // return some info +
-        return array( +
-            'author' => 'Thorsten Stratmann', +
-            'email'  => 'thorsten.stratmann@web.de', +
-            'date'   => '2009-02-04', +
-            'name'   => 'fontfamily Plugin', +
-            'desc'   => 'With fontfamily you can control the typeface of your text +
-                         Syntax: <ff Value>Your Text</ff>', +
-            'url'    => 'http://wiki.splitbrain.org/plugin:fontfamily', +
-        ); +
-    } +
-  +
-     // What kind of syntax are we? +
-    function getType(){ return 'formatting';+
-  +
-    // What kind of syntax do we allow (optional) +
-    function getAllowedTypes() { +
-        return array('formatting', 'substition', 'disabled'); +
-    } +
-    +
-   // What about paragraphs? (optional) +
-   function getPType(){ return 'normal';+
-  +
-    // Where to sort in? +
-    function getSort(){ return 92; } +
-  +
-  +
-    // Connect pattern to lexer +
-    function connectTo($mode) { +
-      $this->Lexer->addEntryPattern('(?i)<ff(?: .+?)?>(?=.+</ff>)',$mode,'plugin_fontfamily'); +
-    } +
-    function postConnect() { +
-      $this->Lexer->addExitPattern('(?i)</ff>','plugin_fontfamily'); +
-    } +
-  +
-  +
-    // Handle the match +
-    function handle($match, $state, $pos, &$handler) +
-    { +
-        switch ($state)  +
-        { +
-          case DOKU_LEXER_ENTER :  +
-            preg_match("/(?i)<ff (.+?)>/", $match, $ff);   // get the fontfamily +
-           if ( $this->_isValid($ff[1]) ) return array($state, $ff[1]); +
- break; +
- case DOKU_LEXER_MATCHED : +
- break; +
- case DOKU_LEXER_UNMATCHED : +
- return array($state, $match); +
- break; +
- case DOKU_LEXER_EXIT : +
- break; +
- case DOKU_LEXER_SPECIAL : +
- break; +
-+
- return array($state, ""); +
-+
-  +
-    // Create output +
-    function render($mode, &$renderer, $data) { +
-        if($mode == 'xhtml'){ +
-          list($state, $ff) = $data; +
-          switch ($state) { +
-            case DOKU_LEXER_ENTER :  +
-              $renderer->doc .= "<span style=\"font-family: $ff\">"; +
-              break; +
-            case DOKU_LEXER_MATCHED : +
-              break; +
-            case DOKU_LEXER_UNMATCHED : +
-              $renderer->doc .= $renderer->_xmlEntities($ff); +
-              break; +
-            case DOKU_LEXER_EXIT : +
-              $renderer->doc .= "</span>"; +
-              break; +
-            case DOKU_LEXER_SPECIAL : +
-              break; +
-          } +
-          return true; +
-        } +
-        return false; +
-    } +
-    function _isValid($c) { +
-  +
-        $c = trim($c); +
-  +
-        $pattern = "/^(Times New Roman|Arial|Brush Script MT|Comic Sans MS|Georgia|Impact|Trebuchet|Verdana|Webdings])/x"; +
-  +
-  //      if (preg_match($pattern, $c)) return true; +
-    return true; +
-    } +
-+
-</code> +
- +
-==== script.js==== +
- +
-Put this code into ''lib/plugins/fontsize2/script.js'': +
- +
-<code javascript> +
-/* JavaScript function to create fontfamily toolbar in DokuWiki */ +
-/* see http://wiki.splitbrain.org/plugin:fontfamily for more info */ +
- +
-var plugin_fontfamily = { +
-  "TimesNewRoman":        "Times New Roman", +
-  "Arial":        "Arial", +
-  "BrushScriptMT":        "Brush Script MT", +
-  "ComicSansMS":        "Comic Sans MS", +
-  "Georgia":        "Georgia", +
-  "Impact":        "Impact", +
-  "Trebuchet ":        "Trebuchet " , +
-  "Verdana":        "Verdana", +
-  "Webdings":        "Webdings" +
-}; +
- +
-if (isUndefined(user_fontfamily)) { +
-  var user_fontfamily = { }; +
-+
- +
-function plugin_fontfamily_make_fontfamily_button(name, value) { +
- +
-  var b_id = name; // picker id that we're creating +
-  var b_ico = document.createElement('img'); +
-  b_ico.src = DOKU_BASE + 'lib/plugins/fontfamily/images/'+name+'.png'; +
-  var btn = document.createElement('button'); +
- +
-  btn.className = 'pickerbutton'; +
-  btn.value = value; +
-  btn.title = name; +
-  btn.style.height = '2em'; +
-  btn.style.padding = '0em'; +
-  btn.name = value; +
-  btn.appendChild(b_ico); +
-   +
-  var open = "<ff " + value + ">"; +
-  var close ="<\/ff>"; +
-  var sample = name + " Fontfamily"; +
- +
-  btn.onclick = function(){ +
-    insertTags('wiki__text',open,close,sample); +
-    return false; }; +
- +
-  return(btn); +
- +
-+
- +
-function plugin_fontfamily_toolbar_picker() { +
- +
-                  // Check that we are editing the page - is there a better way to do this? +
-                  var edbtn = document.getElementById('edbtn__save'); +
-                  if (!edbtn) return; +
-                   +
-                  var toolbar = document.getElementById('tool__bar'); +
-                  if (!toolbar) return; +
- +
-  // Create the picker button +
-  var p_id = 'picker_plugin_fontfamily'; // picker id that we're creating +
-  var p_ico = document.createElement('img'); +
-  p_ico.src = DOKU_BASE + 'lib/plugins/fontfamily/images/toolbar_icon.png'; +
-  var p_btn = document.createElement('button'); +
-  p_btn.className = 'toolbutton'; +
-  p_btn.title = 'Fontfamily'; +
-  p_btn.appendChild(p_ico); +
-  p_btn.onclick = function() { +
-    showPicker(p_id,this); return false; }; +
- +
-  // Create the picker <div> +
-  var picker = document.createElement('div'); +
-  picker.className = 'picker'; +
-  picker.id = p_id; +
-  picker.style.position = 'absolute'; +
-  picker.style.display = 'none'; +
- +
-  /// Add a button to the picker <div> for each of the colors +
-  for( var ff in plugin_fontfamily ) { +
-    if (!isFunction(plugin_fontfamily[ff])) { +
-      var btn = plugin_fontfamily_make_fontfamily_button(ff, +
-          plugin_fontfamily[ff]); +
-      picker.appendChild(btn); +
-    } +
-  } +
-   +
- +
- +
-  var body = document.getElementsByTagName('body')[0]; +
-  body.appendChild(picker); // attach the picker <div> to the page body +
-  toolbar.appendChild(p_btn); // attach the picker button to the toolbar +
-+
- +
-addInitEvent(plugin_fontfamily_toolbar_picker); +
- +
-//Setup VIM: ex: et ts=2 sw=2 enc=utf-8 : +
- +
-</code> +
- +
-===== Images ===== +
- +
-Additionally you need the images, displayed by clicking the fontfamily button.  +
-Please obtain this images from the installation packet. +
- +
-===== Changelog ===== +
- +
-  * Version 0.1: Created  +
  
-===== Question =====+  * Click on icon make automatic saving comment in Discussion plugin without adding fontfamily syntax 
 +    * Don't use toolbar in Discussion...
  
-<del>Though the plugin works fine within the text, it does not show in the toolbar any more.\\ 
-This happens in Release 2009-12-25c “Lemming” of DokuWiki.\\ 
-Any ideas?(11/05/2010)</del>\\ 
-Fixed. 
plugin/fontfamily.1344204767.txt.gz · Last modified: 2012-08-06 00:12 by 77.34.99.12

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki