@@ -439,19 +439,43 @@ impl LayoutAttributes<'_> {
439439 self
440440 }
441441
442- /// Start writing the `/ColumnWidths` array. The last number in the array is
443- /// used for all extra columns. PDF 1.6+.
444- pub fn column_widths ( & mut self ) -> TypedArray < ' _ , f32 > {
445- self . dict . insert ( Name ( b"ColumnWidths" ) ) . array ( ) . typed ( )
442+ /// Start writing the `/ColumnWidths` array. PDF 1.6+.
443+ pub fn column_widths ( & mut self ) -> TrackSizes < ' _ > {
444+ TrackSizes :: start ( self . dict . insert ( Name ( b"ColumnWidths" ) ) )
446445 }
447446
448- /// Start writing the `/ColumnGap` array. The last number in the array is used
449- /// for all extra columns. PDF 1.6+.
450- pub fn column_gap ( & mut self ) -> TypedArray < ' _ , f32 > {
451- self . dict . insert ( Name ( b"ColumnGap" ) ) . array ( ) . typed ( )
447+ /// Start writing the `/ColumnGap` array. PDF 1.6+.
448+ pub fn column_gap ( & mut self ) -> TrackSizes < ' _ > {
449+ TrackSizes :: start ( self . dict . insert ( Name ( b"ColumnGap" ) ) )
452450 }
453451}
454452
453+ /// Writer for a _column tracks attribute value_. PDF 1.6+.
454+ ///
455+ /// This writer is created by [`LayoutAttributes::column_widths`] and
456+ /// [`LayoutAttributes::column_gap`].
457+ pub struct TrackSizes < ' a > {
458+ obj : Obj < ' a > ,
459+ }
460+
461+ writer ! ( TrackSizes : |obj| Self { obj } ) ;
462+
463+ impl < ' a > TrackSizes < ' a > {
464+ /// Write the same value for all column or gap tracks.
465+ pub fn uniform ( self , value : f32 ) {
466+ self . obj . primitive ( value) ;
467+ }
468+
469+ /// Start writing an array of values for individual tracks. If there are
470+ /// more tracks than values, the last value is used for all remaining
471+ /// tracks.
472+ pub fn individual ( self ) -> TypedArray < ' a , f32 > {
473+ self . obj . array ( ) . typed ( )
474+ }
475+ }
476+
477+ deref ! ( ' a, TrackSizes <' a> => Obj <' a>, obj) ;
478+
455479/// The inline alignment.
456480#[ derive( Debug , Copy , Clone , Default , Eq , PartialEq , Hash ) ]
457481pub enum InlineAlign {
0 commit comments