Skip to content
ExamplesOpen editor ↗

dintlhaTsaMokwalo

Returns points along text outlines.

dintlhaTsaMokwalo(fonte, mafoko, x, y, [seelo], [nolofatso])

Pass a font loaded with tlisaMofutatlhaka. Returns an array of points with x, y and alpha (path angle), without drawing or changing the font. Set text size and alignment first with bogoloJwaMokwalo and rulaganyaMokwalo. Sampling defaults to 0.1; larger values generate more points. Simplification defaults to 0; positive values remove nearly collinear points using an angle threshold in radians. Both options are positional numbers. This interface samples a single line with the current text settings; it does not expose wrapping boxes. The bundled jetbrains-mono-bold.ttf supports outlines; nunito.ttf currently supports drawn text only.

NameTypeDescription
fontemofutatlhakaA loaded font.
mafokomokwaloThe text to sample.
xpaloText x position.
ypaloText y position.
seelo (optional)paloSampling factor; defaults to 0.1.
nolofatso (optional)paloSimplification angle in radians; defaults to 0.
Returns points along text outlines
tiro setaLoeto() {
  thalaKanefase(320, 220);
  bokamorago(235);
  diri fonte = letela tlisaMofutatlhaka("jetbrains-mono-bold.ttf");
  bogoloJwaMokwalo(82);
  diri dintlha = dintlhaTsaMokwalo(fonte, "Bopa", 35, 145, 0.2);
  gopheta (diri ntlha mo dintlha) {
    thalaSediko(ntlha.x, ntlha.y, 3);
  }
  emisaPoapoeletso();
}

tlisaMofutatlhaka, bogoloJwaMokwalo, balaLenaane