GLUTSTROKEWIDTH(3)

πŸ“¦
version 3.8.0 Β· 2 versions
, in centos-stream 10, centos-stream 9, fedora 43, fedora 44, opensuse-leap 16.0

πŸ’– GLUTSTROKEWIDTH(3) πŸ’–

okay bestie, gather round, because we're talking about glutStrokeWidth from the OpenGLUT - fonts library. yes it's a whole manual page for one lil function and yes it absolutely ate. ✨


🌸 NAME 🌸

glutStrokeWidth β€” tells you the width, in pixels, of a character in a font you picked. that's it, that's the job. πŸ’…


πŸ“š LIBRARY πŸ“š

OpenGLUT - fonts πŸŽ€


✨ SYNOPSIS ✨

#include <openglut.h>

float
glutStrokeWidth(void *fontID, int character);

🫢 PARAMETERS 🫢

  • fontID β€” a GLUT stroked font identifier. like, which font are we even talking about here. πŸ‘‘
  • character β€” a character code. the actual glyph you're curious about. πŸ”€

πŸ’– DESCRIPTION πŸ’–

so basically: this function reports how far the model space origin will advance if you output this character in the font named by fontID. lowkey important for spacing things out, iykyk. πŸ¦‹

heads up though β€” not all letters will use their full width, especially in fixed-width fonts. so like, don't assume every glyph is maxing out its box, because it's not. πŸ™ˆ

and if character is out of range, or if fontID is invalid? you get 0 back. zero. nothing. go home. πŸ’€


😭 CAVEATS 😭

okay this is the part where it gets messy, buckle up. 🎒

Historically, this function has been described as returning a pixel-width, but it was actually implemented to return the width in model-space units, rounded to integers. GLUT never resolved this. freeglut duplicated the confusion. it's giving generational trauma fr fr. πŸ’€

OpenGLUT has decided to stay in model-space and to return the unrounded floating point value. iconic behaviour honestly. ✨

also: an unreleased GLUT 3.8 was supposed to include glutStrokeWidthf() and glutStrokeLengthf() β€” note the *f suffixes β€” but that is not in wide use. so like, don't count on it bestie. πŸ™ˆ


πŸ“ TODO πŸ“

Determine if any glyphs are either wider than this function, or if they render outside of the bounding box given by (0,-descent) by (width,height-descent). πŸ‘€

so yeah, that's an open question. someone go figure it out. not me though. πŸ’…


πŸ‘€ SEE ALSO πŸ‘€


πŸ’‘ reminder: this page is UNDATED, and the source/version line says UNTITLED(). so it's a mystery page. an enigma. main character energy with no backstory. πŸ•΅οΈβ™€οΈ

anyway ily, go measure some glyphs, and remember: model-space units, not pixels. periodt. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά