Skip to main content

CharShape

Struct CharShape 

Source
pub struct CharShape {
Show 32 fields pub text_paint: Option<TextPaint>, pub raw_data: Option<Vec<u8>>, pub font_ids: [u16; 7], pub ratios: [u8; 7], pub spacings: [i8; 7], pub relative_sizes: [u8; 7], pub char_offsets: [i8; 7], pub base_size: i32, pub attr: u32, pub italic: bool, pub bold: bool, pub underline_type: UnderlineType, pub outline_type: u8, pub shadow_type: u8, pub shadow_offset_x: i8, pub shadow_offset_y: i8, pub text_color: ColorRef, pub underline_color: ColorRef, pub shade_color: ColorRef, pub shadow_color: ColorRef, pub border_fill_id: u16, pub strike_color: ColorRef, pub strikethrough: bool, pub subscript: bool, pub superscript: bool, pub emboss: bool, pub engrave: bool, pub emphasis_dot: u8, pub underline_shape: u8, pub strike_shape: u8, pub kerning: bool, pub use_font_space: bool,
}
Expand description

글자 모양 (HWPTAG_CHAR_SHAPE)

Default 는 수동 구현이다 — 파생하면 relative_sizes 가 스펙 위반값 0 이 된다(#4141).

Fields§

§text_paint: Option<TextPaint>

Explicit glyph paint; independent of font weight and advance metrics.

§raw_data: Option<Vec<u8>>

원본 레코드 바이트 (라운드트립 보존용, 있으면 직렬화 시 우선 사용)

§font_ids: [u16; 7]

언어별 글꼴 ID 참조값 (한글, 영어, 한자, 일어, 기타, 기호, 사용자)

§ratios: [u8; 7]

언어별 장평 (50%~200%)

§spacings: [i8; 7]

언어별 자간 (-50%~50%)

§relative_sizes: [u8; 7]

언어별 상대 크기 (10%~250%)

§char_offsets: [i8; 7]

언어별 글자 위치 (-100%~100%)

§base_size: i32

기준 크기 (HWPUNIT, 0pt~4096pt)

§attr: u32

속성 비트 플래그

§italic: bool

기울임 여부

§bold: bool

진하게 여부

§underline_type: UnderlineType

밑줄 종류

§outline_type: u8

외곽선 종류

§shadow_type: u8

그림자 종류

§shadow_offset_x: i8

그림자 X 방향 오프셋 (-100~100%)

§shadow_offset_y: i8

그림자 Y 방향 오프셋 (-100~100%)

§text_color: ColorRef

글자 색

§underline_color: ColorRef

밑줄 색

§shade_color: ColorRef

음영 색

§shadow_color: ColorRef

그림자 색

§border_fill_id: u16

글자 테두리/배경 ID (5.0.2.1 이상)

§strike_color: ColorRef

취소선 색

§strikethrough: bool

취소선 여부

§subscript: bool

위/아래 첨자

§superscript: bool§emboss: bool

양각 여부 (bit 13)

§engrave: bool

음각 여부 (bit 14)

§emphasis_dot: u8

강조점 종류 (bit 21-24, 0=없음, 1=● 2=○ 3=ˇ 4=˜ 5=・ 6=:)

§underline_shape: u8

밑줄 모양 (bit 4-7, 표 27 선 종류: 0=실선, 1=긴점선, …)

§strike_shape: u8

취소선 모양 (bit 26-29, 표 27 선 종류)

§kerning: bool

커닝 여부 (bit 30)

§use_font_space: bool

글꼴에 어울리는 빈칸 사용 여부 (bit 25)

Trait Implementations§

Source§

impl Clone for CharShape

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CharShape

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CharShape

relative_sizes 만 Rust 파생 기본값(0)이 아니라 스펙 기본값 100 이다. 나머지 필드는 파생값과 같다.

§왜 파생 Default 로는 안 되는가 (#4141)

OWPML 은 relSz 를 xs:positiveInteger minInclusive=10 / maxInclusive=250, default="100" 으로 정의한다(mydocs/manual/OWPML SCHEMA/Header XML schema.xml:716-728). 0 은 타입 수준에서 이미 불법이다. 한컴은 실효 크기를 기준 크기 × 상대크기% 로 해석하므로 0 이 저장되면 10pt 글자가 0.1pt 로 그려져 문서가 사실상 백지가 된다 (samples/SO-SUEOP.hwp 변환본 한컴 PDF 실측: 46쪽 10,604 span 전부 0.12pt).

이 값을 채우지 않는 생성 경로가 여럿이다 — HWP3 변환(parser/hwp3/mod.rs:526, HWP3 레코드에 상대크기 개념 자체가 없다), HWPX charPr 의 relSz 자식 부재와 id 갭 채움(parser/hwpx/header.rs:588, :848-858), HML RELSIZE 부재 (parser/hml/reader.rs:599-605), HTML import. 세 라이터(HWP5·HWPX·HML)는 모두 가드 없이 IR 값을 그대로 방출한다. 기본값을 스펙에 맞추면 그 전부가 한 곳에서 해소된다.

HWP5 바이너리 파서는 이미 100 을 폴백한다(parser/doc_info.rs:542-545) — 파생 Default 의 0 은 그 폴백과도 불일치였다.

§장평 ratios (#4161)

OWPML ratio 는 default=“100”, xs:positiveInteger [50,200] 이라 파생값 0 은 타입 수준에서 불법이고, HWP5 파서 폴백(parser/doc_info.rs:528-532)도 100 이다. 렌더러 폭 경로는 전부 ratio > 0.0 폴백이라 0→100 전환의 자체 렌더 산출은 동일하며, 저장 축(HWP5·HWPX·HML)의 스키마 불법값 방출만 사라진다.

§왜 base_size 는 그대로 두는가

OWPML height 는 xs:integer(제약 없음, default=1000)라 0 이 스키마 합법이고, 실표본에서 기본값 base_size 가 소비되는 사례가 없다(#4161 stage1 §5). 반면 1000 으로 바꾸면 doclang/adapter/inline.rs 의 “폰트 정보 없음” sentinel, hidden-text 은닉 판정(0pt→10pt), 무가드 레이아웃 소비(renderer/style_resolver.rs:341) 세 축의 계약이 움직인다. “기본값 유래” 프로버넌스 설계가 필요한 별도 이슈로 남긴다.

§음영색 sentinel (#4155)

shade_color 의 파생 기본값 0 은 검정이고, HWP5 라이터가 그대로 저장하면 한컴이 글자마다 순검정 사각형을 칠해 본문 전체가 검정 막대가 된다(samples/SO-SUEOP.hwp 변환본 한컴 PDF 실측: 3쪽에 줄 크기 검정 fill 65개, 원본은 글리프 크기 35개). rhwp 자신은 이 결함을 볼 수 없다 — 렌더러가 검정을 “음영 없음” sentinel 로 읽는다.

한컴은 “음영 없음“을 0xFFFFFFFF 로 쓴다 — 코퍼스 380건에서 22,189회, 검정은 0회다. HWPX shadeColor="none" 과 한/글 HML 4294967295 도 같은 값으로 수렴한다. 정의는 crate::model::color::NONE 하나이며, 세 라이터(HWP5·HWPX·HML)가 무수정으로 정합한다.

§왜 필드를 전부 나열하는가

CharShape 에 필드가 추가되면 이 impl 이 컴파일 에러를 낸다. 새 필드의 기본값을 스펙과 대조하도록 강제하는 장치다 — 조용한 표류를 막는다.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for CharShape

Source§

impl PartialEq for CharShape

CharShape 비교: raw_data 필드 제외 (라운드트립용 원본 바이트는 논리적 동일성과 무관)

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for CharShape

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> Finish for T

Source§

fn finish(self)

Does nothing but move self, equivalent to drop.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

Source§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
Source§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

Source§

fn to_owned_table(&self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more