Class: Idml::Render::StyleResolver
- Inherits:
-
Object
- Object
- Idml::Render::StyleResolver
- Defined in:
- lib/idml/render/style_resolver.rb
Overview
Extracts styled text runs from an IDML Story. Each run carries the text content plus the CharacterStyleRange attributes that affect rendering (font style, size, fill color, applied font reference).
Defined Under Namespace
Classes: StyledRun
Constant Summary collapse
- DEFAULT_POINT_SIZE =
12.0
Class Method Summary collapse
-
.concatenate(runs) ⇒ Object
Concatenate runs into a single block.
- .extract_runs(story) ⇒ Object
Class Method Details
.concatenate(runs) ⇒ Object
Concatenate runs into a single block. Used when the renderer can't handle per-run styling (e.g., no font metrics available).
43 44 45 |
# File 'lib/idml/render/style_resolver.rb', line 43 def self.concatenate(runs) runs.map(&:text).join end |
.extract_runs(story) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/idml/render/style_resolver.rb', line 16 def self.extract_runs(story) return [] unless story&.inner story.inner.paragraph_style_range.flat_map do |psr| csr_runs(psr) end end |