fabien van mook

all packages "fvm-*"

package "fvm-textblock"

function file "textblockframe.m"

Function s = textblockframe(s)
         s = textblockframe(s,opt)

draws frames around the text blocks given by string(s) in s.

The input argument s is a character row vector or a
cell-array of character row vectors. The output argument
will have the same form as the input argument s.

Concatenation of the result of textblockframe() into one
string can be obtained with textblockcat():
  textblockcat( textblockframe(s,opt), opt )

The optional input arugment opt is a struct or a row
cell-array of key-value pairs. Below, settings are
indicated by opt as a struct, and the default value of
each field are given too:

  opt.frametmpl = "default";
    opt.frametmpl is a string with the name of a built-in
    frame template, or a column cell-array of character
    row vectors. An example a frame template is:
        {
          " 112333455";
          "1┌───┬───┐";
          "1│   │   │";
          "2│ * │ * │";
          "3│   │   │";
          "3├───┼───┤";
          "3│   │   │";
          "4│ * │ * │";
          "5│   │   │";
          "5└───┴───┘";
        };
    It has the following properties:
    -- at least 2 by 2 cells are drawn.
    -- each row has the same number of characters.
    -- the first row contains single digits for the
       column indices.
    -- each first column in each row contains a single
       digit for the row indices.
    -- column indices and row indices may only range from
       1 to 9.
    -- characters with indices (2,2), (2,4), ..., (4,2),
       (4,4), ..., will represent the respective text
       blocks given by input argument s.

  opt.linedelim = "\n";
    opt.linedelim contains the line delimiter, i.e. the
    character by which lines are separated within a
    string.

The function takes care of the utf-8 encoding of strings,
and accounts for the real number of characters instead of
simply counting the number of bytes in a string.

The function internally calls the following non-standard
m-files:
-- kvpairs2struct.m
-- utf8_to_uint32.m
-- utf8_from_uint32.m
-- textblocksize.m
-- repmatfit.m
-- strcellhcat.m


(c) 2026 fabien van mook

2026.08.20 release of this file within package "fvm-textblock" under GNU GPLv3+