diff options
author | fvogel <fvogelnew1@free.fr> | 2017-02-05 21:49:45 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2017-02-05 21:49:45 (GMT) |
commit | 0c9f2b0c9ca4fa95f8ca05e108865c325d86887a (patch) | |
tree | ee997a5bdc390ec6bf1b207a77ae223a46bd47c3 | |
parent | 6efcb7945c84043ca8c083b6b9309b5d5c2e96fe (diff) | |
download | tk-0c9f2b0c9ca4fa95f8ca05e108865c325d86887a.zip tk-0c9f2b0c9ca4fa95f8ca05e108865c325d86887a.tar.gz tk-0c9f2b0c9ca4fa95f8ca05e108865c325d86887a.tar.bz2 |
Make soft hyphens render (be displayed) when located at the end of a display line, even if the font used has no corresponding glyph
-rw-r--r-- | generic/tkTextDisp.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index b4fb3b6..570e166 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -7890,7 +7890,7 @@ CharDisplayProc( * corresponds to y. */ { CharInfo *ciPtr = chunkPtr->clientData; - const char *string; + char *string; TextStyle *stylePtr; StyleValues *sValuePtr; int numBytes, offsetBytes, offsetX; @@ -7975,6 +7975,23 @@ CharDisplayProc( if (ch == 0x00AD) { len -= nBytes; } + } else { + + /* + * On OS X, the soft hyphen does not render (there is no + * corresponding glyph in OS X fonts). Display a regular + * hard hyphen instead. + */ + +#ifdef MAC_OSX_TK + nBytes = TkUtfToUniChar(Tcl_UtfPrev(string + start + len, + string + start), &ch); + if (ch == 0x00AD) { + string[start + len - nBytes] = '-'; + string[start + len - nBytes + 1] = '\0'; + len -= nBytes - 1; + } +#endif } if (len <= 0) { @@ -8038,6 +8055,23 @@ CharDisplayProc( if (ch == 0x00AD) { numBytes -= nBytes; } + } else { + + /* + * On OS X, the soft hyphen does not render (there is no + * corresponding glyph in OS X fonts). Display a regular + * hard hyphen instead. + */ + +#ifdef MAC_OSX_TK + nBytes = TkUtfToUniChar(Tcl_UtfPrev(string + numBytes, string), + &ch); + if (ch == 0x00AD) { + string[numBytes - nBytes] = '-'; + string[numBytes - nBytes + 1] = '\0'; + numBytes -= nBytes - 1; + } +#endif } Tk_DrawChars(display, dst, stylePtr->fgGC, sValuePtr->tkfont, string, |