mirror of https://github.com/mosra/magnum.git
Browse Source
Empty input was asserting originally, but such strict behavior doesn't seem to be useful in practice as all application code would need to explicitly make sure that shape() isn't called if the input or the input range is empty. In particular, I hit this assert as soon as I rebuilt and ran magnum-player, and the assertion didn't really uncover any bug or make anything better by firing. Treating zero glyph output as a failure also isn't good -- rendering for example a string of whitespace may also result in zero glyphs on the output, which isn't a failure. Plus it's currently unclear what should actually be a failure -- neither FreeType nor HarfBuzz really have a concept of the shaping operation failing, hb_shape() returns void -- so special-casing glyphCount() being zero as a failure just doesn't make sense. This thus means the doScript(), doLanguage() and doDirection() implementations are now called always, regardless of whether shape() was called at all, or whether it produced any glyphs. This allows the shaper for example to give back a detected script etc even if the actual input range to shape was empty.pull/168/head
4 changed files with 53 additions and 74 deletions
Loading…
Reference in new issue