use crate::model::document::DocInfo;
pub(super) fn resolve(doc_info: &DocInfo, hangul2024: bool) -> (Option<usize>, bool) {
let style = doc_info
.styles
.iter()
.find(|style| {
style.local_name == "쪽 번호" || style.english_name.eq_ignore_ascii_case("Page Number")
})
.or_else(|| {
if !hangul2024 {
return None;
}
doc_info.styles.iter().find(|style| {
style.local_name == "바탕글" || style.english_name.eq_ignore_ascii_case("Normal")
})
});
let id = style.map(|style| style.char_shape_id as usize);
let hft = id
.and_then(|id| doc_info.char_shapes.get(id))
.and_then(|shape| doc_info.font_faces.get(1)?.get(shape.font_ids[1] as usize))
.is_some_and(|face| face.alt_type == 2);
(id, hft)
}