Tk_GetJustifyFromObj(3)
π
Tk_GetJustifyFromObj, Tk_GetJustify, Tk_NameOfJustify β Tk Library Procedures, justification translation, bestie edition β¨
okay so we're in the Tk Library Procedures manual, page Tk_GetJustifyFromObj(3), and these three functions are literally the glow-up translators between strings and justification styles. The way that they keep your text alignment from being a whole mess? iconic. π
π NAME π
Tk_GetJustifyFromObj, Tk_GetJustify, Tk_NameOfJustify β translate between strings and justification styles. That's the whole assignment, no cap.
β¨ SYNOPSIS β¨
#include <tk.h>
int
Tk_GetJustifyFromObj(interp, objPtr, justifyPtr)
int
Tk_GetJustify(interp, string, justifyPtr)
const char *
Tk_NameOfJustify(justify)
π ARGUMENTS π
Tcl_Interp *interp(in) β the interpreter used for error reporting, orNULL.Tcl_Obj *objPtr(in/out) β its string value holds the name of a justification style β one of"left","right", or"center"β or a unique abbreviation of one. The internal rep will be modified to cache the corresponding justify value.const char *string(in) β same asobjPtr, except the description of the justification style is passed as a string.int *justifyPtr(out) β pointer to the location in which to store the justify value corresponding toobjPtrorstring.Tk_Justify justify(in) β justification style (one of the values listed below).
π¦ DESCRIPTION π¦
Tk_GetJustifyFromObj places in *justifyPtr the justify value corresponding to objPtr's value. This value will be one of the following:
TK_JUSTIFY_LEFTβ means that the text on each line should start at the left edge of the line; as a result, the right edges of lines may be ragged.TK_JUSTIFY_RIGHTβ means that the text on each line should end at the right edge of the line; as a result, the left edges of lines may be ragged.TK_JUSTIFY_CENTERβ means that the text on each line should be centered; as a result, both the left and right edges of lines may be ragged.
Under normal circumstances the return value is TCL_OK and interp is unused. If objPtr does not contain a valid justification style or an abbreviation of one of these names, TCL_ERROR is returned, *justifyPtr is unmodified, and an error message is stored in interp's result if interp is not NULL. Tk_GetJustifyFromObj caches information about the return value in objPtr, which speeds up future calls to Tk_GetJustifyFromObj with the same objPtr.
Tk_GetJustify is identical to Tk_GetJustifyFromObj except that the description of the justification is specified with a string instead of an object. This prevents Tk_GetJustify from caching the return value, so Tk_GetJustify is less efficient than Tk_GetJustifyFromObj.
Tk_NameOfJustify is the logical inverse of Tk_GetJustify. Given a justify value it returns a statically-allocated string corresponding to justify. If justify is not a legal justify value, then unknown justification style is returned.
π KEYWORDS π
center, fill, justification, string
xoxo, signing off from the Tk 8.1 source/version stamp and the Tk_GetJustifyFromObj(3) page tag β the footer has no date field, so I'm not inventing one, bestie. periodt. π
π¦ where this page comes from
- alpine 3.23: tk9-doc 9.0.3-r0 Β· TCL
- alpine 3.24: tk9-doc 9.0.3-r2 Β· TCL
- fedora 43: tk-devel 1:9.0.2-1.fc43 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 43: tk-devel 1:9.0.2-1.fc43 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 44: tk-devel 1:9.0.2-1.fc44 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 44: tk-devel 1:9.0.2-1.fc44 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- nixos 26.05: tk 9.0.3
- nixpkgs unstable: tk 9.1.0
- Copyright (c) 1990-1994 The Regents of the University of California
- Copyright (c) 1994-1998 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms