On this page:
uni-table->pict
5.1 ECMA-48 SGR Pict
sgr-pict-font
get-sgr-pict-font-size
sgr-color->color
sgr-state+  string->pict
sgr-state+  string->picts
sgr-list->pict
sgr-list->picts
sgr-lines->pict
5.2 Pict Conversion
table->pict
8.12

5 Pict Renderer🔗ℹ

 (require uni-table/pict) package: uni-table

Use this module to output the result in DrRacket REPL or under similar environment.

procedure

(uni-table->pict tbl 
  [#:cell-borders cell-borders-spec 
  #:row-borders rows-borders-spec 
  #:column-borders columns-borders-spec 
  #:col-borders alt-columns-borders-spec 
  #:border-style border-style-spec 
  #:cell-align cell-align-spec 
  #:row-align row-align-spec 
  #:column-align column-align-spec 
  #:col-align alt-column-align-spec 
  #:cell-style cell-style-spec 
  #:row-style row-style-spec 
  #:column-style column-style-spec 
  #:col-style alt-column-style-spec 
  #:table-border table-borders-spec 
  #:column-widths column-widths-spec 
  #:col-widths alt-column-widths-spec]) 
  pict?
  tbl : table/c
  cell-borders-spec : borders-spec/c = '()
  rows-borders-spec : (spec-template-of borders-spec/c) = '()
  columns-borders-spec : (spec-template-of borders-spec/c) = '()
  alt-columns-borders-spec : (spec-template-of borders-spec/c)
   = '()
  border-style-spec : sgr-style-spec/c = '()
  cell-align-spec : alignment-spec/c = '()
  row-align-spec : (spec-template-of alignment-spec/c) = '()
  column-align-spec : (spec-template-of alignment-spec/c) = '()
  alt-column-align-spec : (spec-template-of alignment-spec/c)
   = '()
  cell-style-spec : sgr-style-spec/c = '()
  row-style-spec : (spec-template-of sgr-style-spec/c) = '()
  column-style-spec : (spec-template-of sgr-style-spec/c) = '()
  alt-column-style-spec : (spec-template-of sgr-style-spec/c)
   = '()
  table-borders-spec : borders-spec/c = '()
  column-widths-spec : column-widths-spec/c = '()
  alt-column-widths-spec : column-widths-spec/c = '()
Converts given table to pict? using table->pict.

5.1 ECMA-48 SGR Pict🔗ℹ

 (require uni-table/private/sgr-pict) package: uni-table

This module handles rendering strings with ECMA SGR sequences into a picture. It is intended mainly for usage with DrRacket and for rendering colored output to documentation.

parameter

(sgr-pict-font)  symbol?

(sgr-pict-font font)  void?
  font : symbol?
A parameter? determining which font to use for converting sgr-lines? to a pict?. Defaults to 'modern.
A procedure? which returns the font size used for converting sgr-lines? to a pict?.

Defaults to: (λ () ((get-current-code-font-size)))

procedure

(sgr-color->color color)  (list/c byte? byte? byte?)

  color : 
(or/c (integer-in 0 255)
      sgr-rgb?)
Converts a given SGR color specification - either an index to 8, 16, or 256 color palette or sgr-rgb? value - to a list of three byte? values representing the red, green, and blue channels respectively. This value can be used with colorize directly.

procedure

(sgr-state+string->pict state str)  pict?

  state : sgr-state?
  str : string?
Converts a given string? to a pict? using provided sgr-state? for specifying graphic rendering properties.

procedure

(sgr-state+string->picts state str)  
pict? pict?
  state : sgr-state?
  str : string?
Converts a given string? to a pair of pict?s using provided sgr-state? for specifying graphic rendering properties. The first returned value represents the foreground and the second one is the background image.

procedure

(sgr-list->pict slst)  pict?

  slst : sgr-list?
Converts a given sgr-list? to a pict?. Starts with empty-sgr-state - therefore any styling must be part of the given list. As ecma-csi-sgr-parse-lines produces the lists with prepended sgr-state?, it is used as a basic block for rendering sgr-lines?.

procedure

(sgr-list->picts slst)  
pict? pict?
  slst : sgr-list?
Converts a given sgr-list? to a pair of pict?s. Starts with empty-sgr-state - therefore any styling must be part of the given list. As ecma-csi-sgr-parse-lines produces the lists with prepended sgr-state?, it is used as a basic block for rendering sgr-lines?. The first returned value represents the foreground and the second one is the background image.

procedure

(sgr-lines->pict slines)  pict?

  slines : sgr-lines?
Converts a block of sgr-list? lines into a pict?.

5.2 Pict Conversion🔗ℹ

 (require uni-table/private/table-pict) package: uni-table

This module performs all the transformation and prerendering like the printing module but instead of producing output to a output-port? or string?, it creates a pict? which can be displayed in DrRacket or rendered into a scribble document.

procedure

(table->pict tbl    
  [#:cell-borders cell-borders-spec    
  #:row-borders rows-borders-spec    
  #:column-borders columns-borders-spec    
  #:border-style border-style-spec    
  #:cell-align cell-align-spec    
  #:row-align row-align-spec    
  #:column-align column-align-spec    
  #:cell-style cell-style-spec    
  #:row-style row-style-spec    
  #:column-style column-style-spec    
  #:table-border table-borders-spec    
  #:column-widths column-widths])  pict?
  tbl : table/c
  cell-borders-spec : borders-spec/c = '()
  rows-borders-spec : (spec-template-of borders-spec/c) = '()
  columns-borders-spec : (spec-template-of borders-spec/c) = '()
  border-style-spec : sgr-style-spec/c = '()
  cell-align-spec : alignment-spec/c = '()
  row-align-spec : (spec-template-of alignment-spec/c) = '()
  column-align-spec : (spec-template-of alignment-spec/c) = '()
  cell-style-spec : sgr-style-spec/c = '()
  row-style-spec : (spec-template-of sgr-style-spec/c) = '()
  column-style-spec : (spec-template-of sgr-style-spec/c) = '()
  table-borders-spec : borders-spec/c = '()
  column-widths : column-widths-spec/c = '()
Like print-table and table->string but converts the resulting table into a pict?.