Width of each character. - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: Width of each character. (/thread-18250.html) |
Width of each character. - matalog - 04-11-2022 07:51 PM It seems that there is no way to select a fixed width font on the calculator, so is there a way to know the width of each used character, for example, so that they can be deleted if typed in error? M for example, takes up more than 8 pixels wide and . takes up 8 or less. If I use 8 pixels wide to delete characters, it works most of the time, but it doesn't work properly with the likes of M and i'm sure there are others. RE: Width of each character. - matalog - 04-11-2022 09:16 PM I can use string manipulation to amend the string by one character and then redraw the whole string, but would still be interested if there is a way to know the width of each character. RE: Width of each character. - Jacob Wall - 04-12-2022 05:13 AM TEXTOUT_P() returns the X coordinate at which the next character of the string should be drawn if it had more characters (from the Help). So with a bit of trial and error you could figure it out from that, here's a sample to get started: Code: EXPORT ChrWidth() RE: Width of each character. - matalog - 04-13-2022 09:38 PM Thanks, that's great. Is there a way to return the pixel from TEXTOUT() with it not actually printing the text to screen? RE: Width of each character. - StephenG1CMZ - 04-13-2022 10:22 PM I assume this will work: TEXTOUT(text, [G]... The optional G parameter (an integer) allows one of several screens to be specified (all but one of which will be off-screen). RE: Width of each character. - Tyann - 04-14-2022 04:40 AM (04-11-2022 07:51 PM)matalog Wrote: It seems that there is no way to select a fixed width font on the calculator, so is there a way to know the width of each used character, for example, so that they can be deleted if typed in error? Bonjour Sur les dernières version du Firware il y a TEXTSIZE [TEXTSIZE(chaîne,font) renvoie {largeur,hauteur} Hello On the latest version of Firware there is TEXTSIZE [TEXTSIZE(string,font) returns {width,height} RE: Width of each character. - toml_12953 - 04-14-2022 04:43 AM All of this would be so unnecessary if they would just allow us to choose a fixed-width font for the terminal. Tabular output would be a lot neater, too. |