<table><tr><td style="">mglb created this revision.<br />mglb added a reviewer: Konsole.<br />mglb added a project: Konsole.<br />mglb requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D15757">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>The uni2characterwidth tool, converts Unicode Character Database files<br />
into character width lookup tables. It uses a template file to place<br />
the tables in a source code file together with a function for finding<br />
the width for specified character. It also allows to generate few forms<br />
of lists with width data for debug and test purposes, or for future use<br />
as a replacement of Unicode files.</p>

<p>Set <tt style="background: #ebebeb; font-size: 13px;">KONSOLE_BUILD_UNI2CHARACTERWIDTH</tt> cmake flag to build the tool.<br />
Use <tt style="background: #ebebeb; font-size: 13px;">--help</tt> argument for more detailed usage.</p>

<p>There is a possibility to generate separate "width" for Ambiguous<br />
characters. It can be used to add ability to configure the characters<br />
width in Konsole settings.</p>

<p>The <tt style="background: #ebebeb; font-size: 13px;">example.template</tt> file contains all possible named tags, and some<br />
additional tags to show how to use them.</p>

<p>CCBUG: 396435</p>

<p>Depends on <a href="https://phabricator.kde.org/D15756" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">D15756</a></p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Download files listed below from <tt style="background: #ebebeb; font-size: 13px;">11.0.0</tt> and <tt style="background: #ebebeb; font-size: 13px;">emoji/11.0</tt> directories<br />
on <tt style="background: #ebebeb; font-size: 13px;">https://unicode.org/Public/</tt>. You can also directly use URLs to the<br />
files.</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">UnicodeData.txt</li>
<li class="remarkup-list-item">EastAsianWidth.txt</li>
<li class="remarkup-list-item">emoji-data.txt</li>
</ul>

<p>Generate any available list except compact-ranges (e.g. <tt style="background: #ebebeb; font-size: 13px;">details</tt>):</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">uni2characterwidth \
    -U UnicodeData.txt  -A EastAsianWidth.txt  -E emoji-data.txt \
    -g details  result.txt</pre></div>

<p>The list should contain ranges for all possible widths<br />
(-2, -1, 0, 1, 2). You can choose some characters with a width you know<br />
and check how they were classified. -2 is a special non-standard width<br />
for ambiguous characters, which can be overriden by adding <tt style="background: #ebebeb; font-size: 13px;">-a 1</tt> or<br />
<tt style="background: #ebebeb; font-size: 13px;">-a 2</tt> parameter. With this flag, all ranges from -2 group should<br />
disappear and become assigned to selected width (1 or 2).</p>

<p>Generate output using a template:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">uni2characterwidth \
    -U UnicodeData.txt  -A EastAsianWidth.txt  -E emoji-data.txt \
    -g code,./template.example  result.txt</pre></div></div></div><br /><div><strong>BRANCH</strong><div><div>arc/396435/Add-a-tool-for-generating-character-width-tables (branched from master)</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D15757">https://phabricator.kde.org/D15757</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/CMakeLists.txt<br />
tools/CMakeLists.txt<br />
tools/uni2characterwidth/CMakeLists.txt<br />
tools/uni2characterwidth/properties.h<br />
tools/uni2characterwidth/template.cpp<br />
tools/uni2characterwidth/template.example<br />
tools/uni2characterwidth/template.h<br />
tools/uni2characterwidth/uni2characterwidth.cpp</div></div></div><br /><div><strong>To: </strong>mglb, Konsole<br /><strong>Cc: </strong>konsole-devel, herrold, ngraham, maximilianocuria, hindenburg<br /></div>