Tk_GetDash(3)

πŸ“¦
version 9.0.3 Β· 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

πŸ’– Tk_GetDash β€” the Tk Library Procedures glow-up πŸ’–

okay bestie, gather round, because we're talking about Tk_GetDash(3) from the Tk Library Procedures and it's genuinely such a vibe once you get it. it takes a string and turns it into a real, valid dash structure. that's it. that's the whole girl. ✨


✨ NAME ✨

Tk_GetDash β€” convert from string to valid dash structure. iconic, no notes πŸ’…


🌸 SYNOPSIS 🌸

#include <tk.h>

int
Tk_GetDash(interp, string, dashPtr)

πŸŽ€ ARGUMENTS πŸŽ€

  • Tcl_Interp *interp (in) β€” the interpreter she reports her errors to, aka the group chat where the drama gets posted. πŸ’¬
  • const char *string (in) β€” the textual value that's getting converted. the raw material, the clay, the before pic. πŸ¦‹
  • Tk_Dash *dashPtr (out) β€” points to the place where the converted dash pattern value gets stored. must not be NULL, bestie, don't do that. πŸ™ˆ

πŸ’œ DESCRIPTION πŸ’œ

so this procedure parses the string and fills in the result inside the Tk_Dash structure. the string can be either a list of integers, or a character string containing only .,-_ and spaces. if all goes well, TCL_OK is returned and a dash descriptor is stored in the variable pointed to by dashPtr. and if string doesn't have the proper syntax? TCL_ERROR comes back, an error message gets left in the interpreter's result, and literally nothing is stored at *dashPtr. nothing. not a crumb. 😭


🌈 syntax number one: the list of integers

The first possible syntax is a list of integers. Each element represents the number of pixels of a line segment. Only the odd segments are drawn using the outline color. The other segments are drawn transparent. so like, alternating pixels of yes and no. main character pixels and background pixels. ⭐

πŸ¦‹ syntax number two: the character list

The second possible syntax is a character list containing only 5 possible characters .,-_ plus space. The space can be used to enlarge the space between other line elements, and can not occur in the first position of the string β€” so no leading space, she does not start with space, periodt. some examples:

-dash .     = -dash {2 4}
-dash -     = -dash {6 4}
-dash -.    = -dash {6 4 2 4}
-dash -..   = -dash {6 4 2 4 2 4}
-dash {. }  = -dash {2 8}
-dash ,     = -dash {4 4}

The main difference between this syntax and the numeric one is that it's shape-conserving. which means all values in the dash list get multiplied by the line width before display. so "." is always gonna show up as an actual dot and "-" is always gonna show up as an actual dash, no matter what the line width is doing. consistency queen. πŸ‘‘

⚠️ heads up: on systems where there's only a limited set of dash patterns available, the dash pattern will be displayed as the closest dash pattern that IS available. for example, on Windows only the first 4 of the examples above are available; the last 2 examples will be displayed identically to the first one. so on Windows, {. } and , are lowkey just cosplaying as .. πŸ’€

πŸ”₯ SEE ALSO πŸ”₯


πŸ’« KEYWORDS πŸ’«

dash, conversion


and that's the whole page, bestie! 🫢 this one's from Tk 8.3, dated right there in the footer with the Tk_GetDash(3) title β€” so if you're out here dashing on anything older, check yourself before you wreck yourself. go forth and dash responsibly. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from