From dccf9e3966f99581d0983ef21fae2acb3ed86f8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20M=C3=BCller?= Date: Sun, 5 Oct 2014 20:45:08 +0200 Subject: [PATCH] header size setting added --- LANDING.md | 2 +- README.md | 4 ++-- resources/public/js/themes.js | 3 ++- resources/public/styles/main.less | 27 +++++++++++++++++++++++---- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/LANDING.md b/LANDING.md index a59589a..69c4146 100644 --- a/LANDING.md +++ b/LANDING.md @@ -9,7 +9,7 @@ - **API**: Integrate the publishing functionality into your editor using the official [NoteHub API](/api). ## Changelog - - **2014-09**: text size setting added ([example](/2014/3/31/demo-note?text-font=monospace&header-font=Courier&text-size=0.8)) + - **2014-09**: text size setting added ([example](/2014/3/31/demo-note?text-font=monospace&header-font=Courier&text-size=0.7&header-size=1.1)) - **2014-07**: deprecated all API versions less than 1.4 & performance improvements. - **2014-03**: note expiration implemented. - **2014-02**: a simple JS-client for API testing [added](/api-test.html). diff --git a/README.md b/README.md index 5aa665e..768563d 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,9 @@ and for the text itself: notehub.org/.../title?header-font=FONT-NAME&text-font=FONT-NAME2 -Analogously, you can specify you can change the text size by specifying a scale factor: +Analogously, you can specify you can change the text or header size by specifying a scale factor: - notehub.org/.../title?header-font=FONT-NAME&text-font=FONT-NAME2&text-size=1.5 + notehub.org/.../title?header-font=FONT-NAME&text-font=FONT-NAME2&text-size=1.1&header-size=1.2 See an example of the font formatting [here](http://www.notehub.org/8m4l9). diff --git a/resources/public/js/themes.js b/resources/public/js/themes.js index b410d1f..908c65b 100644 --- a/resources/public/js/themes.js +++ b/resources/public/js/themes.js @@ -98,7 +98,8 @@ if(ui["header-font"] || ui["text-font"]) { }, ""); } -if(ui["text-size"]) vars["@font_size"] = ui["text-size"] + "em"; +if(ui["text-size"]) vars["@text_size_factor"] = ui["text-size"]; +if(ui["header-size"]) vars["@header_size_factor"] = ui["header-size"]; fontURL = fontURL.replace(/%s/, injection); var fileref = document.createElement("link") diff --git a/resources/public/styles/main.less b/resources/public/styles/main.less index 36d6d44..6cfaec8 100644 --- a/resources/public/styles/main.less +++ b/resources/public/styles/main.less @@ -13,7 +13,8 @@ @header_font: 'Noticia Text'; @text_font: 'Georgia'; -@font_size: 1.2em; +@header_size_factor: 1; +@text_size_factor: 1; // mixins .helvetica { @@ -110,6 +111,24 @@ h1, h2, h3, h4, h5, h6 { font-weight: bold; font-family: @header_font,'Noticia Text','PT Serif','Georgia'; } +h1 { + font-size: 1.8em * @header_size_factor; +} +h2 { + font-size: 1.6em * @header_size_factor; +} +h3 { + font-size: 1.4em * @header_size_factor; +} +h4 { + font-size: 1.2em * @header_size_factor; +} +h5 { + font-size: 1.1em * @header_size_factor; +} +h6 { + font-size: 1em * @header_size_factor; +} #hero h1 { font-size: 2.5em; } @@ -124,12 +143,12 @@ article { text-align: justify; } article p { - font-size: @font_size; + font-size: 1.2em * @text_size_factor; line-height: 140%; } article > h1:first-child { text-align: center; - font-size: 2em; + font-size: 2em * @header_size_factor; margin: 2em; } .centered { @@ -141,7 +160,7 @@ article > h1:first-child { code, pre { font-family: monospace; background: @background_halftone; - font-size: @font_size; + font-size: 1.2em * @text_size_factor; } pre { border-radius: 3px;