Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
font-family and UNICODE hyphen
11-03-2011, 11:41 PM, (This post was last modified: 11-04-2011, 12:22 AM by RobertShiplett.)
#1
font-family and UNICODE hyphen
Many proportional fonts look much better when hyphenated words use a true hyphen U+2010 rather than the US keyboard 'minus-hyphen' character. This is particularly the case in German text containing a great many hyphenated neologisms.

In the code below, if the font-family is not specified or is set to a generic "serif", the hyphen may appear as an overstrike of an unprintable character (the unsightly super-imposed empty rectangle.)

A complete list of your available fonts is part of the test page below:

{curl 7.0,8.0 applet}
{curl-file-attributes character-encoding="utf8"}

{set-document-properties
font-family="DejaVu Serif, Lucida Sans Unicode, Arial Unicode MS, DejaVu, serif, sans-serif",
||
|| font-family = "serif",
|| setting to "serif" ONLY or NOT setting will fail to display \u2010 correctly as a hyphen
||
font-size=14pt,
background={Background.from-string "linen"}
}

|| true hyphen ‐
|| dash –
|| true minus sign −
|| US kybd 'minus' -

{title heading?=false, Font Hyphen Test}

|| http://de.wikipedia.org/wiki/Gradiva
|| http://www.freud.org.uk/photo-library/detail/67734/

{heading level=1, Font Hyphen Test}

{def tb={TextFlowBox {text


{def tb={TextFlowBox {text

with hyphen-minus U+002D {center e-h} {br}

with true‐hyphen U+2010 {center e\u2010h} {br}

with soft hyphen U+00AD {center e\u00ADh} {br}

with hard hyphen U+2011 {center e\u2011h} {br}

with ndash U+2013 {center e\u2013h} {br}}}}
{def dc= {tb.get-display-context}}

{def arr = {dc.get-font-names} }

{for n:String in arr do
{tb.add {value n}}
{tb.add {br} }
}

{let fnt:Font = {Font "Lucida Sans Unicode", 14pt } }

{let correct:bool = {dc.font-can-display-char? fnt, '\u2010' } }
{if correct then
{tb.add
{paragraph Hyphen tests as test\u2010test }
}}

{set correct = {dc.font-can-display-char? fnt, '\u2011' } }
{if correct then
{tb.add
{paragraph Hyphen tests as test\u2011test }
}}

{set correct = {dc.font-can-display-char? fnt, '\u00AD' } }
{if correct then
{tb.add
{paragraph Hyphen tests as test\u00ADtest }
}}

{set correct = {dc.font-can-display-char? fnt, '\u002D' } }
{if correct then
{tb.add
{paragraph Hyphen tests as test\u002Dtest }
}}

{value tb}

|| end of font tests
|| NOTE: setting to "serif" ONLY in the doc properties may result in \u2010 \u2011 and \u00AD not displaying correctly as hyphens even with the character encoding set to utf8.

|| The font-can-display-char? test is of no help. A bug?

|| When 00AD displays, I leave 002D (the - key) for Curl code and use 002D in place of 2010 or 2011 in the literary text which I am formatting for display. The display may be the same, but the text remains ready for an upgrade to hard- and soft-hyphens in the future.
Robert Shiplett, Curlr
Fredericton NB

Canada


Possibly Related Threads...
Thread Author Replies Views Last Post
  Font Zoom RobertShiplett 1 3,246 12-08-2012, 03:37 AM
Last Post: RobertShiplett
  Hanazono Mincho font RobertShiplett 0 3,379 05-08-2012, 01:02 AM
Last Post: RobertShiplett
  font-family = "serif" RobertShiplett 0 2,665 04-29-2012, 11:04 PM
Last Post: RobertShiplett
Forum Jump:


Users browsing this thread:
1 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
Query:
INSERT INTO mybb_threadviews (tid) VALUES('334')