<div dir="ltr">Now that basic things of the backend are stabilized, I think it is time to think about the way lineWidth can be filled (or any other imaginable way of using the result <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/hh994452(v=vs.85).aspx">"GetJustifiedGlyphs"</a> of <a href="https://github.com/behdad/harfbuzz/blob/abae93faef32562f34a72981d252c848cc4f7565/src/hb-directwrite.cc#L787">this backend</a> on clients) so I've uploaded <a href="https://github.com/behdad/harfbuzz/pull/279">this</a> in hope to start the discussion of how harfbuzz can get [kashida] justification which all clients would be able to use.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 27, 2016 at 4:03 AM, Ebrahim Byagowi <span dir="ltr"><<a href="mailto:ebraminio@gmail.com" target="_blank">ebraminio@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Great. Thanks for the reviews, <a href="https://github.com/behdad/harfbuzz/pull/273/commits/8179ff5d7ba4a140cf6743729a22072800e98a79" target="_blank">done</a>.</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 27, 2016 at 3:01 AM, Nikolay Sivov <span dir="ltr"><<a href="mailto:bunglehead@gmail.com" target="_blank">bunglehead@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 27.06.2016 0:58, Ebrahim Byagowi wrote:<br>
> I had a chance to improve some minor thing around DirectWrite backend of<br>
> HarfBuzz on this pull request<br>
</span>> <<a href="https://github.com/behdad/harfbuzz/pull/273" rel="noreferrer" target="_blank">https://github.com/behdad/harfbuzz/pull/273</a>> which basically is<br>
<span>> suggestion of Nikolay reviews on this mail<br>
</span>> <<a href="https://lists.freedesktop.org/archives/harfbuzz/2015-September/005066.html" rel="noreferrer" target="_blank">https://lists.freedesktop.org/archives/harfbuzz/2015-September/005066.html</a>>.<br>
<span>> Thank you Nikolay for the suggestions and sorry for the delay :)<br>
<br>
</span>Hi, Ebrahim.<br>
<br>
You're very welcome, thanks for working on this.<br>
<br>
Another issue I see with current implementation (which is minor because<br>
it will allocate more than needed, not less, but still):<br>
<br>
> retry_getglyphs:<br>
>   uint16_t* clusterMap = (uint16_t*) malloc (maxGlyphCount * sizeof (uint16_t));<br>
>   uint16_t* glyphIndices = (uint16_t*) malloc (maxGlyphCount * sizeof (uint16_t));<br>
>   DWRITE_SHAPING_TEXT_PROPERTIES* textProperties = (DWRITE_SHAPING_TEXT_PROPERTIES*)<br>
>     malloc (maxGlyphCount * sizeof (DWRITE_SHAPING_TEXT_PROPERTIES));<br>
>   DWRITE_SHAPING_GLYPH_PROPERTIES* glyphProperties = (DWRITE_SHAPING_GLYPH_PROPERTIES*)<br>
>     malloc (maxGlyphCount * sizeof (DWRITE_SHAPING_GLYPH_PROPERTIES));<br>
<br>
Cluster map and text properties should use WCHAR text length, not glyph<br>
count.<br>
<br>
><br>
>   hr = analyzer->GetGlyphs (textString, textLength, fontFace, FALSE,<br>
>     isRightToLeft, &runHead->mScript, localeName, NULL, &dwFeatures,<br>
>     featureRangeLengths, 1, maxGlyphCount, clusterMap, textProperties, glyphIndices,<br>
>     glyphProperties, &glyphCount);<br>
><br>
>   if (unlikely (hr == HRESULT_FROM_WIN32 (ERROR_INSUFFICIENT_BUFFER)))<br>
>   {<br>
>     free (clusterMap);<br>
>     free (glyphIndices);<br>
>     free (textProperties);<br>
>     free (glyphProperties);<br>
><br>
>     maxGlyphCount *= 2;<br>
><br>
>     goto retry_getglyphs;<br>
>   }<br>
<br>
And this could do realloc() or free/malloc on glyphIndices and<br>
glyphProperties only, because text length never changes.<br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>