Skip to content

Devanagari short-i ligature is not renedered correctly in preview #41480

Closed

Description

@phil-davis

Steps to reproduce

  1. Use PHP 8.3 and the ImageMagick etc underlying language font and image rendering tools.
  2. Run the test scenario apiWebdavPreviews/previews.feature:211
  Scenario: it should update the preview content if the file content is updated (content with UTF chars)
    Given user "Alice" has uploaded file "filesForUpload/lorem.txt" to "/lorem.txt"
    And user "Alice" has uploaded file with content "सिमसिमे पानी" to "/lorem.txt"
    When user "Alice" downloads the preview of "/lorem.txt" with width "32" and height "32" using the WebDAV API
    Then the HTTP status code should be "200"
    And the downloaded image should be "32" pixels wide and "32" pixels high
    And the downloaded preview content should match with "सिमसिमे-पानी.png" fixtures preview content

Expected behaviour

The test should pass - the Nepali Devanagari text should be rendered correctly in the PNG image.

Actual behaviour

The Nepai Devanagari text short-i is not rendered correctly when converted into a PNG preview file.

See discussion comments from #41449 (comment) onwards.

Server configuration

CI with core master and PHP 8.3

Activity

  1. DeepDiver1975 commented on Jun 24, 2026

    @DeepDiver1975
    Contributor

    🤖 Automated issue triage by Claude Code review agent.

    Triaging this as analysis-only: this is a font/text-shaping limitation in the underlying rendering toolchain rather than a located defect in ownCloud core code.

    Root cause (already established in the linked PR #41449 discussion). The Devanagari short-i vowel sign (ि / i-matra) must render to the left of the consonant it modifies, which requires complex-script (OpenType/HarfBuzz) text shaping. The preview generation goes through ImageMagick, and when ImageMagick lacks complex-script layout support (or is built without HarfBuzz / with a font configuration that doesn't shape Devanagari), the short-i ligature is placed on the wrong consonant — "सिमसिमे" renders with the matra mis-positioned (transliterated "smismie" instead of "simsime").

    This is reproducible outside ownCloud entirely, directly from the command line, which confirms it is not a core code bug:

    convert -size 300x300 xc:white -font Noto-Sans-Devanagari-Regular -pointsize 16 -fill black -annotate +20+20 "मेसिदीद" output_image_file.png
    

    Other Devanagari vowel ligatures render fine; only the short-i matra is mis-placed. See the related upstream discussion: python-pillow/Pillow#3191

    Why analysis-only:

    • The behavior is dependent on the ImageMagick build / HarfBuzz support / installed Devanagari font on the host, not on ownCloud's preview provider logic.
    • It is not a regression in core; it is a known limitation of complex-script shaping in the image toolchain.
    • The maintainer decision in PR feat: php8.3 #41449 was to skip the affected acceptance test and reference this issue rather than attempt a code fix — and that is already in place: tests/acceptance/features/apiWebdavPreviews/previews.feature:211 carries @issue-41480 @skip.

    Suggested follow-up (no core code change):

    • Optionally add a replacement test case using text from a script that does not abuse reordering ligatures, so preview-content regression coverage is retained without the short-i edge case.
    • If correct Devanagari shaping in previews becomes a priority, investigate the ImageMagick build / HarfBuzz support and Devanagari font on the rendering host (this is environment/toolchain work, not core code).

    No fix PR is being opened (core is excluded from automated fix fleets, and this is environment/toolchain-dependent rather than a located core defect).

  2. self-assigned this
    on Jun 24, 2026
  3. phil-davis commented on Jun 24, 2026

    @phil-davis
    ContributorAuthor

    True, this is a feature of the underlying resources that are used for rendering various character sets. In the end, for a production system, the admin of that system has to ensure that all the needed rendering resources are installed to cover the character stets, fonts etc. that they want to routinely support.

    I am assigned. I will adjust the test scenario so that it uses characters from the Devanagari character set that do currently render "easily" and correctly. That will avoid this particular vowel ligature rendering issue.

  4. dj4oC commented on Jul 8, 2026

    @dj4oC
    Contributor

    Before this can be acted on, the following needs to be resolved:

    • A product decision on whether the preview text-rendering path should change at all. Verifying against the actual code: text previews are generated in lib/private/Preview/TXT.php via PHP's GD extension (imagettftext() / imagettfbbox(), i.e. FreeType) using the in-repo bundled font core/fonts/NotoSansDevanagari/NotoSansDevanagari-Regular.ttf — not ImageMagick as the reproduction steps and earlier discussion suggest. GD/FreeType renders glyphs in logical order and has no complex-script shaping engine (no HarfBuzz), so the Devanagari short-i matra (ि) cannot be reordered to the left of its consonant. This is a limitation of the GD/FreeType dependency, so there is no located defect in ownCloud's preview logic to change without either introducing a shaping dependency or switching rendering engines. Someone with authority needs to decide whether that investment is in scope.

    • Confirmation of the intended resolution / acceptance criteria. The assignee has stated the plan is to change the acceptance scenario (tests/acceptance/features/apiWebdavPreviews/previews.feature:211) to use Devanagari text that renders correctly, rather than fix shaping. That is a test-only change and needs confirmation that the goal is simply to keep CI green (swap the test string) versus actually supporting correct complex-script rendering in previews — these are entirely different pieces of work, and the current issue title reads as the latter while the agreed plan is the former.

    🤖 Automated by Claude Code


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions