A right-to-left document renders against the left edge, and `start`/`end` alignment resolves to the wrong side
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Start in the odrcore submodule: HtmlWriter::write_begin (html_writer.cpp:134) is where dir/lang would go on <html>. read_text_align (odf_style.cpp:108) maps start/end to left/right — first decide with the maintainer whether to keep start/end in TextAlign and emit text-align:start/end, or resolve at translation time. Then parse style:writing-mode into ParagraphStyle (style.hpp:166) and emit it in translate_paragraph_style (document_style.cpp:237). Done when an Arabic document renders flush right and mixed-direction paragraphs are ordered correctly.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
A user asked for right-to-left support in a Play Store review of 4.18.0, in Arabic, rating the app 5 ★ anyway. #468 is the same request from a support email, and #108 asked for it in 2019 and was closed without it. This is what is actually missing, because it is three separate things and only one of them is a feature.
The fix is in odrcore in all three cases; nothing on the Android side is involved. odrcore has #326 for the spreadsheet half of this.
The view has no base direction
HtmlWriter::write_begin writes a bare <html> (html_writer.cpp:134). No dir, no lang, anywhere in the output. So the WebView takes the default base direction, which is left-to-right.
That is not "Arabic does not render". The Unicode bidi algorithm still orders an Arabic run right-to-left inside a line, so a paragraph of pure Arabic reads correctly. What breaks is everything that depends on the paragraph's own direction: the sentence lands against the left edge, trailing punctuation goes to the wrong end, and a paragraph mixing Arabic with Latin words or digits is ordered by the wrong base.
style:writing-mode is never read
ODF states paragraph and page direction as style:writing-mode, rl-tb being right-to-left. Nothing parses it — there is no writing_mode anywhere in internal/odf/, and ParagraphStyle (style.hpp:166) has no field to put it in. The only writing-mode the translator ever emits is vertical-lr for a rotated table cell (document_style.cpp:415), which is unrelated.
So even with a base direction on <html>, a right-to-left paragraph inside an otherwise left-to-right document would still come out wrong, and vice versa.
start and end alignment resolve to the wrong edge
This one is a bug rather than a gap, and it is the visible one.
read_text_align (odf_style.cpp:108) maps fo:text-align values start → TextAlign::left and end → TextAlign::right, unconditionally. But start and end are relative to the writing direction: in a right-to-left paragraph start is the right edge. translate_paragraph_style (document_style.cpp:237) then writes that out as a literal text-align:left.
start is what writers emit for ordinary body text rather than left, so this hits the common case: a right-to-left document whose paragraphs are simply default-aligned renders flush left, and it stays flush left even if the base direction is fixed, because the wrong edge was baked in at parse time.
What we could do
TextAlign has the shape of the problem in it — left/right/center/justify, with no start/end. Two ways out:
- Keep
start/endall the way to the CSS. Add them toTextAlignand emittext-align:start/text-align:end, which browsers resolve against the element's direction. Then parsestyle:writing-modeinto a direction onParagraphStyle, emit it asdirection:rtl, and the alignment follows for free. The public enum gains two values, so this is a breaking change for the bindings. - Resolve at translation time, once direction is known, and leave the enum alone. Cheaper, and it puts the writing direction into the style model either way — so it is most of the same work with a worse result.
Either way <html dir> (or a direction on the document root element) still has to be set from the document's page style, or a document that states nothing per paragraph gets no direction at all.
Worth deciding whether the same pass carries lang, which is in the ODF too and which nothing currently emits — it is what a screen reader and hyphenation need, and it is the same attribute pair.
- Ngôn ngữ chính
- Kotlin
- Star
- 473
- Fork
- 44
- Merge trung bình
- 4 giờ 7 phút
- Pull request đã merge (30 ngày)
- 54
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của opendocument-app/OpenDocument.droid
-
UI
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
opendocument-app/OpenDocument.droid#724 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
UI
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 66/100
opendocument-app/OpenDocument.droid#723 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
opendocument-app/OpenDocument.droid#484 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
opendocument-app/OpenDocument.droid#722 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
right hand margin failĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
opendocument-app/OpenDocument.droid#690 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của opendocument-app/OpenDocument.droid
Issue tương tự
-
[Submission] 悠悠有品Đang mởsubmit-adaption submit-adaption-pre
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
BetterAndroid/android-notification-icon-project#763 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
scarif-labs/horus#61 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 87/100
damontecres/Wholphin#2093 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
FossifyOrg/Messages#929 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
cr:missing-repro cr:platform:android missing-repro platform:android
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
software-mansion/react-native-screens#4950 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày