Track two-column class options in the document model

This commit is contained in:
gloamxun committed 2026-10-20 01:23:55 +08:00
1 parent fb361b7df9
commit 3afa8dc6c1
2 files changed
+9

No files matched your search

+3
View File
@@ -122,6 +122,8 @@ pub struct DocumentModel {
pub page: PageSize,
pub parindent: common::Scaled,
/// Base font size selected by the document class (10, 11, or 12pt).
/// Number of text columns (1 for article, 2 for `iicol`/`twocolumn`).
pub columns: u8,
pub base_font_size: u8,
pub margins: PageMargins,
pub show_title: bool,
@@ -159,6 +161,7 @@ impl Default for DocumentModel {
page: PageSize::default(),
// article's default \parindent for 10/11pt text.
parindent: common::Scaled(17 * 65_536),
columns: 1,
base_font_size: 10,
margins: PageMargins::default(),
show_title: false,
@@ -1121,6 +1121,12 @@ impl Parser {
}
expanded::FrontendEventKind::Geometry(settings) => {
apply_class_font_size(&mut self.document, settings);
if settings
.split(",")
.any(|option| matches!(option.trim(), "iicol" | "twocolumn"))
{
self.document.columns = 2;
}
apply_geometry(&mut self.document, settings);
}
expanded::FrontendEventKind::TextStyleStart(style) => self.begin_style(*style),