{"id":959,"date":"2020-04-30T16:35:51","date_gmt":"2020-04-30T23:35:51","guid":{"rendered":"https:\/\/nisus.com\/blogs\/?p=959"},"modified":"2020-09-10T12:18:34","modified_gmt":"2020-09-10T19:18:34","slug":"line-wraps-and-the-zero-width-joiner","status":"publish","type":"post","link":"https:\/\/nisus.com\/blogs\/line-wraps-and-the-zero-width-joiner\/","title":{"rendered":"Line Wraps and the Zero-Width Joiner"},"content":{"rendered":"<p>Sometimes the most exciting thing about an iOS update is all the new emojis. In recent history the <a href=\"https:\/\/www.cultofmac.com\/661744\/ios-13-2\/\">new emojis in iOS 13.2<\/a> included several interesting characters:<\/p>\n<p style=\"text-align:center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/nisus.com\/blogs\/wp-content\/uploads\/2020\/04\/emoji-sloth.png\" width=\"160\" height=\"160\" style=\"max-width:32%\" alt=\"sloth emoji\"\/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/nisus.com\/blogs\/wp-content\/uploads\/2020\/04\/emoji-ice.png\" width=\"160\" height=\"160\" style=\"max-width:32%\" alt=\"ice cube emoji\"\/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/nisus.com\/blogs\/wp-content\/uploads\/2020\/04\/emoji-jupiter.png\" width=\"160\" height=\"160\" style=\"max-width:32%\" alt=\"ringed planet emoji\"\/><\/p>\n<p>That last one is technically called the <a href=\"https:\/\/emojipedia.org\/ringed-planet\">Ringed Planet emoji<\/a>; but let&#8217;s get real, that&#8217;s Saturn. Even in emoji-form the cosmos is beautiful. <a href=\"https:\/\/www.nasa.gov\/mission_pages\/juno\/images\/\">These photos of Jupiter taken by the Juno probe<\/a> are particularly stunning in their detail.<\/p>\n<p>What does this have to do with line wrapping? We&#8217;ll get to that. First let&#8217;s explain a technical detail about emojis. Most Unicode characters and emojis have a distinct Unicode code point (aka character code). Each code tells software what character to display. The number 127823 is an apple, while 129411 is a turkey. But sometimes a new emoji will not have a new code. Instead the emoji is designated using a composite of existing codes. For example, the female chef emoji does not have a distinct code. Instead it combines the woman emoji with the frying pan emoji:<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/nisus.com\/blogs\/wp-content\/uploads\/2020\/04\/emoji-female-chef.png\" style=\"max-width:100%\" alt=\"how the female chef emoji is composed\"\/><\/p>\n<p>How does does an emoji do that in text? By using a <i>zero-width joiner<\/i> character between its constituent characters. That way software knows to display all the codes together as a single glyph or image on screen. This joiner trick is used for a <a href=\"https:\/\/blog.emojipedia.org\/emoji-zwj-sequences-three-letters-many-possibilities\/\">variety of purposes like skin tone and gender modifiers<\/a>.<\/p>\n<p>Now to the part where we explain how the zero-width joiner character can help your writing. In certain situations you might consider inserting a joiner character to change where line wrapping occurs. The joiner acts as a signal to the text layout engine that the adjacent characters should be joined. You can think of the joiner like a glob of glue that keeps its neighbors together. The characters won&#8217;t display a single image as with emoji, but rather they will be kept together on the same line.<\/p>\n<p>Consider the following example text:<br \/>\n<img decoding=\"async\" src=\"https:\/\/nisus.com\/blogs\/wp-content\/uploads\/2020\/05\/wrap-text1.png\" style=\"max-width:100%\" alt=\"text example\"\/><\/p>\n<p>The page margins may cause an undesirable wrapping point at the slash, so the words &#8220;when&#8221; and &#8220;if&#8221; are split across lines like so:<br \/>\n<img decoding=\"async\" src=\"https:\/\/nisus.com\/blogs\/wp-content\/uploads\/2020\/04\/wrap-text2.png\" style=\"max-width:100%\" alt=\"text badly wrapped to margins\"\/><\/p>\n<p>To prevent that you can place the insertion point after the slash character and insert a zero-width joiner character. That instructs text layout to keep the slash character together with the &#8220;i&#8221; in &#8220;if&#8221; like so:<br \/>\n<img decoding=\"async\" src=\"https:\/\/nisus.com\/blogs\/wp-content\/uploads\/2020\/04\/wrap-text3.png\" style=\"max-width:100%\" alt=\"fixed line wrapping by using zero-width joiner\"\/><\/p>\n<p>To insert the joiner character in <a href=\"https:\/\/nisus.com\/pro\">Nisus Writer Pro<\/a> you can use the menu <i style=\"white-space:nowrap;\">Insert &gt; Special Character &gt; Spaces &gt; Zero Width Joiner<\/i>, or use our <a href=\"https:\/\/nisus.com\/pro\/help\/Enter-Type-Text.html\">customizable Special Characters palette<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes the most exciting thing about an iOS update is all the new emojis. In recent history the new emojis in iOS 13.2 included several interesting characters: That last one&hellip;<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,14],"tags":[],"class_list":["post-959","post","type-post","status-publish","format-standard","hentry","category-general","category-tips"],"_links":{"self":[{"href":"https:\/\/nisus.com\/blogs\/wp-json\/wp\/v2\/posts\/959","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nisus.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nisus.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nisus.com\/blogs\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/nisus.com\/blogs\/wp-json\/wp\/v2\/comments?post=959"}],"version-history":[{"count":23,"href":"https:\/\/nisus.com\/blogs\/wp-json\/wp\/v2\/posts\/959\/revisions"}],"predecessor-version":[{"id":993,"href":"https:\/\/nisus.com\/blogs\/wp-json\/wp\/v2\/posts\/959\/revisions\/993"}],"wp:attachment":[{"href":"https:\/\/nisus.com\/blogs\/wp-json\/wp\/v2\/media?parent=959"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nisus.com\/blogs\/wp-json\/wp\/v2\/categories?post=959"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nisus.com\/blogs\/wp-json\/wp\/v2\/tags?post=959"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}