<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep xmlns="">
<header>
  <title>Message Fancying</title>
  <abstract>This specification defines a Unicode-formatted fancy text syntax for use in instant messages.</abstract>
  
<legal>
<copyright>This XMPP Extension Protocol is copyright © 1999 – 2024 by the <link url="https://xmpp.org/">XMPP Standards Foundation</link> (XSF).</copyright>
<permissions>Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.</permissions>
<warranty>## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##</warranty>
<liability>In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.</liability>
<conformance>This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at &lt;<link url="https://xmpp.org/about/xsf/ipr-policy">https://xmpp.org/about/xsf/ipr-policy</link>&gt; or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).</conformance>
</legal>
  <number>0457</number>
  <status>Active</status>
  <type>Humorous</type>
  <sig>None</sig>
  <approver>Editor</approver>
  <dependencies>
    <spec>XMPP Core</spec>
    <spec>XMPP IM</spec>
  </dependencies>
  <supersedes>
    <spec>XEP-0071</spec>
    <spec>XEP-0393</spec>
    <spec>XEP-0394</spec>
  </supersedes>
  <supersededby/>
  <shortname>fancying</shortname>
  
  <author>
    <firstname>Georg</firstname>
    <surname>Lukas</surname>
    <email>georg@op-co.de</email>
    <jid>georg@yax.im</jid>
  </author>

  <revision>
    <version>1.0.0</version>
    <date>2021-04-01</date>
    <initials>XEP Editor (jsc)</initials>
    <remark>Initial published version.</remark>
  </revision>
  <revision>
    <version>0.0.1</version>
    <date>2021-04-01</date>
    <initials>gl</initials>
    <remark><p>First draft.</p></remark>
  </revision>
</header>
<section1 topic="Introduction" anchor="intro">
  <p>
    XMPP-based Instant Messages has suffered from a lack of proper message
    styling mechanisms. After abandoning <span class="ref"><link url="https://xmpp.org/extensions/xep-0071.html">XHTML-IM (XEP-0071)</link></span> <note>XEP-0071: XHTML-IM &lt;<link url="https://xmpp.org/extensions/xep-0071.html">https://xmpp.org/extensions/xep-0071.html</link>&gt;.</note> for its horrible security
    track record, <span class="ref"><link url="https://xmpp.org/extensions/xep-0393.html">Message Styling (XEP-0393)</link></span> <note>XEP-0393: Message Styling &lt;<link url="https://xmpp.org/extensions/xep-0393.html">https://xmpp.org/extensions/xep-0393.html</link>&gt;.</note> and <span class="ref"><link url="https://xmpp.org/extensions/xep-0394.html">Message Markup (XEP-0394)</link></span> <note>XEP-0394: Message Markup &lt;<link url="https://xmpp.org/extensions/xep-0394.html">https://xmpp.org/extensions/xep-0394.html</link>&gt;.</note> were proposed as replacements, but
    neither was able to gain sufficient traction to become the default styling
    mechanism.
  </p>
  <p>
    This specification fills the gap by formally specifying the Unicode-based
    formatting that is currently fancied on Social Media and micro-blogging as
    an XMPP standard for Instant Messaging. As XMPP is based on UTF-8, messages
    formatted with this mechanism are immediately visible on all receiving
    clients. Simple third-party tools can be used for writing messages until
    this specification is integrated into the IM message input boxes.
  </p>
</section1>
<section1 topic="Requirements" anchor="reqs">
  <p>This specification relies on Unicode features introduced in the 3.1
    specification. As XMPP implementations are required to support Unicode 3.2
    for StringPrep during SASL authentication, no new requirements arise.</p>
</section1>
<section1 topic="Use Cases" anchor="usecases">
  <ul>
    <li>
      As a user sending an instant message to a friend, I want to be able to
      emphasize an important part of my message.
    </li>
    <li>
      As a software developer, I want to be able to send code as pre-formatted,
      monospace, block or inline text to another developer.
    </li>
    <li>
      As a user of non-Latin script, I want to be surprised by inconsistent
      transitions and missing range checks resulting in characters from random
      Unicode planes.
    </li>
    <li>
      As a visually impaired user, I want my screen reader to emit long
      sequences of technical names of Unicode special characters to really
      convey the point of the intended emphasis, character by character!
    </li>
    <li>
      As a multi-user chat user I want to add context to my reply by quoting an
      earlier message in the chat.
    </li>
  </ul>
</section1>
<section1 topic="Business Rules" anchor="rules">
  <section2 topic="Preformatted Text" anchor="pre">
    <p>To format a string as Preformatted Text, the individual code-points need
      to be converted to their integer representation, then increased by
      <tt>0x1D62F</tt> (capital letters) or <tt>0x1D629</tt> (lowercase letters)
      and then converted back to characters.</p>
    <div class="example">Preformatted text → 𝙿𝚛𝚎𝚏𝚘𝚛𝚖𝚊𝚝𝚝𝚎𝚍 𝚝𝚎𝚡𝚝</div>
  </section2>
  <section2 topic="Emphasis" anchor="emphasis">
    <p>To format a string with Emphasis, the individual code-points need
      to be converted to their integer representation, then increased by
      <tt>0x1D3F3</tt> (capital letters) or <tt>0x1D3ED</tt> (lowercase letters)
      and then converted back to characters.</p>
    <div class="example">Emphasis → 𝐸𝑚𝑝ℎ𝑎𝑠𝑖𝑠</div>
  </section2>
  <section2 topic="Strong Emphasis" anchor="strong">
    <p>To format a string with Strong Emphasis, the individual code-points need
      to be converted to their integer representation, then increased by
      <tt>0x1D3BF</tt> (capital letters) or <tt>0x1D3B9</tt> (lowercase letters)
      and then converted back to characters.</p>
    <div class="example">Strong Emphasis → 𝐒𝐭𝐫𝐨𝐧𝐠 𝐄𝐦𝐩𝐡𝐚𝐬𝐢𝐬</div>
  </section2>
  <section2 topic="Very Strong Emphasis" anchor="strong-emphasis">
    <p>To format a string with Very Very Strong Emphasis, the individual code-points need
      to be converted to their integer representation, then increased by
      <tt>0x1D427</tt> (capital letters) or <tt>0x1D421</tt> (lowercase letters)
      and then converted back to characters.</p>
    <div class="example">Very Strong Emphasis → 𝑽𝒆𝒓𝒚 𝑺𝒕𝒓𝒐𝒏𝒈 𝑬𝒎𝒑𝒉𝒂𝒔𝒊𝒔</div>
  </section2>
  <section2 topic="Strike through" anchor="strike">
    <p>To format a string as struck through, each code-point needs to be
      extended with a U-0336 COMBINING LONG STROKE OVERLAY postfix.</p>
    <div class="example">Strike through → S̶t̶r̶i̶k̶e̶ ̶t̶h̶r̶o̶u̶g̶h̶</div>
  </section2>
</section1>
<section1 topic="Implementation Notes" anchor="impl">
  <p>Some clients will use a serif-less font instead of a serif font to display
    instant messages, or even allow the user to choose an arbitrary font. The
    formatting defined in this document assumes the use of serif fonts, however.
    If a formatted text is to be displayed in a context that is not supposed to
    render serifs, the displaying implementation MUST add <tt>0x1D4</tt> to the
    respective integer representations of the fancy code-points.
  </p>
  <p>On the wire, the serif representation always MUST be used.</p>
  <p>Determining whether a given display font is serif or sans-serif is out of
    scope of this specification.</p>
</section1>
<section1 topic="Accessibility Considerations" anchor="access">
  <p>𝞜𝞸𝞰𝞮</p>
</section1>
<section1 topic="Internationalization Considerations" anchor="i18n">
  <p>🇳🇴🇳🇪</p>
</section1>
<section1 topic="Security Considerations" anchor="security">
  <p>The rendering of fonts is a complex task performed in the most inner guts
    of the operating system. Over the last decades, various exploits have been
    discovered in all major operating systems. Unfortunately, fixing those
    issues is far beyond the abilities of a simple XMPP client.</p>
</section1>
<section1 topic="IANA Considerations" anchor="iana">
  <p>
    This document requires no interaction with the <span class="ref"><link url="http://www.iana.org/">Internet Assigned Numbers Authority (IANA)</link></span> <note>The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see &lt;<link url="http://www.iana.org/">http://www.iana.org/</link>&gt;.</note>.
  </p>
</section1>
<section1 topic="XMPP Registrar Considerations" anchor="registrar">
  <p>None.</p>
</section1>
</xep>
