make Combining column human-readable

This patch introduces a `CombiningClass` type to represent the canonical
combining class of a codepoint. The `fmt::Display` implementation of
this type writes the human-readable name of the combining class, if
there is one. This replaces the previous behaviour, which was to just
print the raw byte value of the combining class.
This commit is contained in:
pantonshire committed 2022-09-20 16:39:27 +01:00
1 parent f1355b5fe3
commit 26ee43af2e
3 files changed
+57 -12

No files matched your search

+3 -3
View File
@@ -4,7 +4,7 @@ use clap::Parser;
use libshire::strings::CappedString;
use tabled::{Tabled, Table, Style};
use utfdump_core::{chardata::Category, encoded::Data};
use utfdump_core::{chardata::{Category, CombiningClass}, encoded::Data};
const UNICODE_DATA: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/unicode_data_encoded"));
@@ -50,7 +50,7 @@ fn main() {
let ccc = char_data.ccc();
char_combining_class = Optional::Some(ccc);
combining = ccc != 0;
combining = ccc.is_combining();
}
let display_char = {
@@ -91,7 +91,7 @@ struct OutRow {
#[tabled(rename = "Category")]
category: Optional<DisplayCategory>,
#[tabled(rename = "Combining")]
char_combining_class: Optional<u8>,
char_combining_class: Optional<CombiningClass>,
}
#[derive(Debug)]