RTL (Right-to-Left) reading order for Old Chinese Books
Closed this issue · 1 comments
lin1270 commented
I want to render Chinese old books which use rtl mode.
So..how could i do.
espresso3389 commented
pdfrx still does not have enough controll for page snapping or such.
But if you want to do horizontal scrolling, see Horizontal Scroll View.
Basically, for R-to-L reading order, you may change the layout logic to run oppsite order.
layoutPages: (pages, params) {
final height =
pages.fold(0.0, (prev, page) => max(prev, page.height)) +
params.margin * 2;
final width = pages.fold(params.margin * 2, (prev, page) => prev + page.width;
final pageLayouts = <Rect>[];
double x = width;
for (var page in pages) {
x -= page.width + params.margin;
pageLayouts.add(
Rect.fromLTWH(
x,
(height - page.height) / 2, // center vertically
page.width,
page.height,
),
);
}
return PdfPageLayout(
pageLayouts: pageLayouts,
documentSize: Size(width, height),
);
},
Disclaimer: I've not tested the code :(