The page the section before ends on is finished with its own margins and
footnote separators before the starting section's replace them, so the
footnotes pending on it are placed where the page they sit on says.
Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com>
* docx: keep a paragraph's text alignment
w:textAlignment (ECMA-376 17.3.1.39) was not read, so a save dropped it. Word sizes a line by it when a
list's bullet is larger than the text: without it, those lines grow and every page after them moves.
ParaProps gains text_alignment, read and carried through styles, and written back after w:jc. Kept for
the file only; the layout does not use it yet.
* contributors: add entropybeater
---------
Co-authored-by: Brian <255903314+entropybeater@users.noreply.github.com>
Spelling as you type now notes that a web or e-mail address after a
no-break, narrow no-break (U+202F), figure (U+2007) or ideographic space
is not marked while Ignore web and file addresses is on, as
address_after_a_wide_space_is_an_internet_token in craft-proof checks.
* doc, docx: keep the compound border lines
The nine thin and thick compound lines (thinThickSmallGap to thinThickThinLargeGap, ECMA-376 17.18.2)
were read as a single line and written back as one, on paragraphs, tables, cells and pages. BorderStyle
gains them; they are written back by name and drawn as a single line of the border's width, as before.
RTF export and import carry them too (the importer read four of them as double).
* contributors: add entropybeater
---------
Co-authored-by: Brian <255903314+entropybeater@users.noreply.github.com>
metafile_size() parsed the whole metafile, decoding every bitmap and building every path, to
read two numbers at picture insert and replace. A new wordcraft_metafile::size reads the frame
from the EMF header or the placeable WMF header, and falls back to the full parse for every
other file (plain WMF, an EMF without a usable frame, a file with no records), so it returns
what parse would. For an EMF with one 8000x5000 1 bpp bitmap the size now costs well under a
microsecond instead of about 280 ms.
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
decode_clip matched the bit depth, bounds-checked and (for 16 and 32 bpp) divided per channel
for every pixel. The depth, palette and masks are now turned into a row decoder once per
bitmap: a 256-entry colour table for 1/4/8 bpp, plain channel swaps for 24 bpp and default
32 bpp, and precomputed shifts and scale tables for masked 16/32 bpp. Output is byte for byte
the same; the old per-pixel code stays in the tests as the reference.
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
decode_clip only capped width x height at 40 MP. A 32 x 1,250,000 pixel 1 bpp bitmap (about
5 MB in the file) was decoded to 160 MB of RGBA and kept, then dropped by Item::take_pixels
because its side is over MAX_BITMAP_SIDE, while counting against the parse's 256 MB budget.
decode_clip now returns None when the clipped width or height is over the cap, so crops of a
large bitmap that fit still decode.
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
* Pin that a comment id past u32 is refused, not truncated (#3677)
`validate_comment_id` refuses an `id` that does not fit a `u32`, so the `as
u32` casts behind it can no longer reach another comment -- but nothing pinned
it, and the casts are still there to be reached if the guard moves.
The ids the test sends are the ones that would alias onto real comments if the
truncation came back: 2^32 truncates to 0 (and the first comment is 0), 2^32 +
id to that comment, 4294967301 to 5 as the report describes, and u64::MAX to
u32::MAX. Each of the four commands that take an id is tried with each, then
the comments are checked to be unchanged and unresolved, and a valid id is
accepted afterwards so the guard is shown to be a range check rather than a
refusal.
* Comment ids: the values past u32 go in the existing invalid-id test, refused by the range check
anchors_walk_dense_unrelated_markers_in_linear_work compared CPU times of
a few microseconds, so cache and timer noise could push the ratio past its
24x limit on a linear walk (43.52x in a CI run).
wordcraft-doc now counts, in tests only, the characters its paragraph
object lookups walk (objects_before, object_offsets and
objects_with_offsets), through a work::count helper behind the existing
test-support feature. The test asserts that 8x the markers take at most
12x the steps, as the layout linear-time tests do: the walk takes 2001 ->
16001 steps (8.0x), and the object_offsets + object_at walk it replaced
takes 2003001 -> 128024001 (63.9x).
update_generated now keeps what comes before a wrapped list's field, which can be
another list field; rebuild from the converted field's code instead of the
paragraph's first list field, and let index::rebuild_from take that code.
- update_generated keeps what precedes a wrapped list's field (r4468529243)
- from_doc keeps objects in hidden text when hidden text is written (r4469018820)
- clipped cell lines in a turned frame are drawn once, clipped, turned (r4469018900)
- kept::while_writing works out reply map and page fingerprint once per export (r4468529227)
- odt_charts fixture declares its namespaces (r4468529259)
- guard test for character styles based on a missing parent (r4469018843, not a bug)
* Arabic interface: mirrored right-to-left window and Arabic UI fonts
Adds the Arabic (`ar`) interface language's code: its catalogs are craft-i18n's
`locales/ar`, so this changes no catalog.
- `ar` is registered in `i18n::LANGUAGES` and `Lang::rtl()` says it is written
right to left; its translations are used as written (egui's text layout
orders each line's bidi text itself). A ribbon location reads from the right
with a leftwards mark.
- `rtl.rs`: the window is mirrored. Containers open in `rtl::root`; columns,
grids, checkboxes, radio buttons, menus, rows, panels, the dialog tab strip
and the ribbon's scrolling row follow the language's direction. Title bar,
status bar, ribbon tabs and groups, File pages (including Print, with the
settings on the right and a solid scrollbar gutter), dialogs, menus and the
task panes (their docking edge swaps) are laid out from the right. egui's
`Grid` panics in a right-aligned layout, so grids go through `rtl::grid`.
- Arabic UI font fallback: the craft-fonts Arabic face, else an installed
Arabic font, loaded when the interface is Arabic.
- The "Auto (200%)" size label keeps its percent sign inside the isolated
number.
- Tests: Arabic locale, saved preference and lookup order on fixture catalogs;
an interface audit (skipped without the craft-i18n Arabic catalog) that lays
the app out right to left at several widths, checks tab, group, pane, Print
and Go To positions and that nothing panics.
The Arabic work builds on Abdelhaq El Amraoui's mirrored-interface PR (#737).
Co-Authored-By: Abdelhaq El Amraoui <abdelhaqelamraoui@gmail.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Arabic interface: pin craft-i18n at a commit with the Arabic catalog; review fixes
- craft-i18n.rev and the Flatpak manifest pin 19358491 (craft-i18n main), the
first commit line that has locales/ar/wordcraft.tsv. The old pin had no
Arabic catalog, so `ar` was registered but not embedded and two i18n tests
(the_language_setting_is_a_ui_command_and_persists,
the_languages_offered_are_the_embedded_ones_of_the_list) failed in CI.
- The Arabic font fallback is requested for any right-to-left interface
(`Lang::rtl()`), not only after the language picker sets the flag, so an
automatic or saved Arabic gets the installed Arabic face.
- The file browser, the update window and Reading Mode's toolbar run their
bodies in `rtl::root`, so their far-side buttons and rows are mirrored.
- A group in a right-to-left ribbon row is measured from the right edge: the
cursor's left edge is negative infinity there, so its width was NaN and the
ribbon planner dropped every group, never compacting a narrow Arabic window.
A narrow window now folds groups into drop-downs.
- The mirrored checkbox and radio marks are labelled by their text, so screen
readers name them.
- Tests: group width in a right-to-left row; the Arabic interface audit checks
Reading Mode's toolbar.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Arabic interface: ask for the installed Arabic font separately from the CJK one
A previous commit made every right-to-left interface request the installed CJK
fallback font (`system_cjk`) so that the installed Arabic font would load. That
also made every Arabic launch read a large system CJK font file when no
craft-fonts input is embedded (the Flatpak build has none).
`install_ui_fonts` now passes a separate `system_arabic` flag (`Lang::rtl()`):
the installed Arabic font is read for it, and `system_cjk` is again set only
by a CJK interface or by CJK text on screen. `WordApp::fonts_system_arabic`
remembers what was installed, so a language change reinstalls the fonts.
Tests: the_installed_arabic_font_is_asked_for_by_arabic_alone (the Arabic flag
adds the installed font only when none is embedded, and the CJK request alone
adds no Arabic font). Checked a headless screenshot of the Arabic interface
without craft-fonts: the installed Arabic font draws the labels.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Fix the AutoSave switch knob: on is at the right, mirrored in Arabic
The title bar's AutoSave knob was placed with `lead_x(rtl == on, ..)`, which
reverses main's mapping in both directions: left to right it drew the knob at
the left when the switch was on, and right to left at the right. main draws it
at the right when on and at the left when off, so the mirrored interface must
draw it at the left when on: `rtl != on`.
The position is now `autosave_knob_x(rtl, on, track)`, pinned by a test for all
four cases. A headless screenshot of the off switch shows the knob at the left
in English and at the right in Arabic.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Arabic interface: file names and paths in right-to-left lines; kerning row order
Tester feedback on the Arabic interface:
- File > Open's Recent list, the built-in file browser and the title bar drew
file names and paths raw, from the left edge. In an Arabic line the marks of
a name ("(نهائي) 2.docx") and the folders of a path with Arabic parts were
scrambled. Rows now start at the side reading starts from (`rtl::lead_x`),
names go through `i18n::isolate` (a first-strong isolate, with a left-to-right
mark before the extension so `2.docx` stays `2.docx`) and paths through
`i18n::isolate_path` (a left-to-right isolate with a mark after every
separator, so neighbouring Arabic folders do not swap). Other languages get
the text untouched; saved and spoken text never carries the marks.
- Font dialog, Kerning row: the dialog's grid is drawn left to right inside a
right-to-left window, so "Points and above" came after its number; in an
Arabic interface it now comes first, so the line reads "14 نقطة فأكثر" from the
right. (The grid's columns themselves still keep their left-to-right order.)
Tests: names_and_paths_are_isolated_in_a_right_to_left_interface.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Arabic interface: mirror through craft_ui::direction and Style::right_to_left
The suite's craft-ui now has the direction helpers (`craft_ui::direction`) and
its egui fork a `Style::right_to_left` that mirrors egui's own chrome. Use them
instead of our parallel wrappers:
- `rtl::sync(ctx)` applies the interface direction every frame the language's
changes (`direction::apply`): it sets the shared direction state and
`Style::right_to_left` on every theme, which draws check boxes and radio
buttons with the mark at the reading start, mirrors submenus, scroll bars,
title bars and the combo boxes' arrows (the Print page's choice lists, the
font list) and opens combo menus from the right.
- `rtl::checkbox`, `radio_value`, `radio` and `indeterminate_checkbox` are
gone: about 200 call sites use plain `ui.checkbox`, `ui.radio_value`, ... and
egui does the mirroring (and names the control by its text, as a plain widget).
- `lead_x`, `lead_center`, `lead_top`, `start_panel` and `end_panel` delegate to
`craft_ui::direction`. `root`, `flows`, `island`, `grid`, `menu`, `vertical`,
`far_side` and the other layout helpers stay: the shared crate has no
equivalent that fits them.
Visual changes: the combo boxes' drop-down arrows and lists are mirrored in
Arabic; nothing changes in left-to-right languages (checked headless
screenshots of the English main window, Font dialog and Print page).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Recent files and the file browser: full path on hover, long names keep their start
Review feedback:
- Each row of File > Open's Recent list shows the document's full path as its
tooltip (the path line under the name can be longer than the row).
- A long name in the built-in file browser is laid out in one row, with an
ellipsis at its end, from the side reading starts from, instead of being
clipped at the row's edge: in a right-to-left interface the old text anchored
at the right edge cut the end of an Arabic name and the start of a Latin one.
The whole name is the row's tooltip when it was shortened.
Checked headless screenshots of the file browser with a long English and a long
Arabic name.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Font combos in a right-to-left row: the arrow joins its field on the left
The ribbon's font name and size boxes are drawn from a field and a separate
arrow box that share one outline: the field is square and the arrow's box is
rounded on the side where the arrow goes, painted a border width under the
field. That assumed the arrow is right of the field. In a right-to-left row
(the Arabic ribbon) the arrow comes after the field on its left, so the field
was square on the wrong side and the arrow box rounded on the side facing the
field: two boxes with a gap-like seam, the arrow looking outside the frame.
`arrow_box_shape(rtl, ..)` mirrors the radii and the underlap, and the field's
square corners are chosen by the row's direction (the nw/sw pair in right to
left). Left-to-right rows are drawn exactly as before (English before/after
crops are identical).
Test: the_arrow_box_is_rounded_away_from_its_field.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Pin craft-i18n 4612850 (merged Arabic WordCraft rows, craft-i18n#76)
The pin and the Flatpak manifest commit move from 1935849 to 4612850, which is on
craft-i18n main and adds the 70 Arabic rows this branch relies on.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Pin craft-i18n cac2cf0 (Arabic number agreement and status-bar rows)
Moves the pin and the Flatpak manifest commit from 4612850 to the current craft-i18n
main, which includes craft-i18n#95 (48bed03) and #81 (ef58ff3).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Arabic: isolate paths shown beside labels; mirror the Print page zoom
File > Info shows Location as its own left-to-right path label (cut short with the full path on hover, not wrapped), and the open-failure, Exported and dictionary-file messages isolate their paths. The Print preview zoom puts minus at the slider's left end and plus at its right in Arabic, as the status bar does.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Arabic: mirror the label/field rows of the Font, Info, Paragraph, Page Setup, Insert Table and Options forms
rtl::Table lays a form out as an egui Grid in a left-to-right interface (same id, columns and spacing, so the output is unchanged) and, where the interface is mirrored, with each row's cells running from the right, every column as wide as its widest cell. File > Info puts Properties at the right and Statistics after it, and the Font dialog's kerning row reads 14 points and above.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Docs: record the mirrored Arabic interface in the roadmap, gaps and localization parity
Progress log, the Arabic language row, gap 11 and the status lines and revision histories of the three docs.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Arabic interface: Insert Hyperlink, Word Count, Phonetic Guide, New Style, Modify Style, Encrypt, merge rule and Match Fields dialogs read right to left
Their label-and-field rows use rtl::Table, so in a mirrored interface the label is at the right with its field to its left. rtl::Table gains striped() for Match Fields. English renders are pixel-identical (only a caret-blink strip differs in an untouched dialog).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Arabic interface: Line Numbers, Hyphenation, Drop Cap, Caption, Cross-reference, Index, Mark Index Entry and Source dialogs read right to left
Their label-and-field rows use rtl::Table (label at the right, field to its left). English renders are pixel-identical.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Arabic interface: Picture Size, Split Cells, Convert Text to Table, Footnote and Endnote, Table Properties, Cell Options and Custom Properties dialogs read right to left
Their label-and-field rows use rtl::Table. Picture Size's Height and Width pairs read Height first at the right. English renders are pixel-identical.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Arabic interface: Define New Multilevel List, Track Changes Options, content control properties, custom colours and table style dialogs read right to left
Label, field and swatch rows use rtl::Table. English renders are pixel-identical.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Arabic interface: Columns widths, Special Characters, Compare, AutoCorrect and About Models tables read right to left
Table columns now start at the right edge (rtl::Table gains top(), min_row_height() and an unset column count). About > Models stays a left-to-right scroll box with its columns listed from the right. English renders are pixel-identical (only the caret blink differs).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Arabic interface: table-of-contents styles, recipient filter and sort, and the ribbon Paragraph group read right to left
rtl::Table now stacks its rows top to bottom whatever way the area around it runs (a ribbon group lays out in a row). English renders are pixel-identical (caret blink and a status toast differ in untouched dialogs). The TOC options and recipient filter/sort rows are converted by pattern and not seen in an image.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Arabic interface: Columns preset tiles and Preview label, Macros, Add/Remove arrows, Zoom slider and the Recipient List grid
A preset tile is as wide as its caption and centres it (the long Arabic captions ran into the next tile); the Preview column keeps its width so its label no longer wraps letter by letter; Macros puts the name box and list at the reading start with the buttons beside them; the Add >> and << Remove arrows swap in a mirrored interface so they point the way the items move; the Zoom slider is drawn left to right as in English; the Recipient List data grid scrolls left to right instead of running past the left edge. English renders are pixel-identical.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Arabic interface: the chart type and SmartArt layout galleries list their tiles from the right
The chart type dialog, the Insert SmartArt dialog and the ribbon's SmartArt Layouts gallery use rtl::Table rows, so the first tile sits at the reading start. English renders are pixel-identical.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Take main's panes/host.rs after the merge
The merge kept a use of mirrored() that main's pane-dock fix removed; this branch does not touch the panes.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Arabic interface: Columns preset captions are translated in the mirrored tile
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Arabic: one Arabic and one French row in the localization parity table; About > Models columns read from the right
The merge left the Arabic and French rows twice in docs/localization-parity.md; each
is now a single row (main's current French text, the Arabic row with the dialogs
note). About > Models keeps main's fitted table but lists its columns, their
alignments and grow weights reversed when the interface is mirrored, so Company
starts at the reading edge. The credits.rs change comes from tareq's helper merge.
Co-authored-by: tareq <tareq.halaby@gmail.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* About > Models: the mirrored table keeps its own widths and scroll position
The columns are listed in reverse when the interface is mirrored, and egui keeps the
resizable column widths and the scroll offset by id. A language switched at run time
would apply one direction's widths to the other's columns, so the mirrored table uses
its own id.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Arabic interface: About > Models alignment mirrors as its comment says
The mirrored Models table reversed the per-column right-align flags but
did not negate them, so in Arabic the text columns stayed left-aligned and
the counts right-aligned, the opposite of the comment ("counts line up on
the right (left in RTL)"). Negate after reversing so the text sits at the
reading edge and the counts on the left. Keep this line when touching
models_ui.
* About > Models: a mirrored table that overflows opens at its reading edge
The reversed Arabic table puts Company in the rightmost column, but the
horizontal scroll area started at the left, so when the table was wider
than the dialog (narrow window, widened columns) Company and Model were
offscreen. Stick the scroll area to the right in a mirrored interface.
---------
Co-authored-by: Abdelhaq El Amraoui <abdelhaqelamraoui@gmail.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: email <email@email.com>
Co-authored-by: tareq <tareq.halaby@gmail.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>