Pixel Pitch Function (mm global units, round down to closest integer pixel) lazarus / 39-Graphics ---------------------------------------------------------------------- Emptyself · 2022-11-03 13:43 Questions possibly related to: HDPi Display Driver Hardware info, reported by the OS (Operating system) I am unexperienced in computer programming… maybe just after "Hello, world!", if I do not forget «;». I want all my GUI and text based (terminal) interfaces to be based around the simplest form of reading: TEXT (typeface\fonts) UI icons can be only Font–based or .svg (vector) no raster icons (.png, .jpg, .bmp, …) I need my code to get the Pixel Pitch tech. info\value for the current monitor, where my current window (Form) is. Then to have a 'Pixel Pitch' related function to adjust all or any of the UI elements, with Default value equal to the so called «Zoom 100%» I want to work in millimeters [mm], not in pixels, not in dots, not in em–space… because I do not care what the display's PPI (PPcm) is. I want this function to also «bypass» any OS related 'Scaling %' and such nonsense. A minimum requirement for a pleasant readability of a text is the Capital letter to be 3mm, small letter to be 2mm. If the monitor has «big pixels» then obviously The Function should give fonts used a minimum of 12 pixels (min. for Pixel Pitch of 0.233mm) or maybe 14 pixels for "average" 24" desktop monitor 1920×1080 pixels as shown below. So, how can I write such Function in Pascal using Lazarus… and why it has not been done already? Examples: ---------------------------------------------------------------------- KodeZwerg · 2022-11-03 14:48 Quote from: Emptyself on November 03, 2022, 02:43:32 pmI want to work in millimeters [mm], not in pixels, not in dots, not in em–space… because I do not care what the display's PPI (PPcm) is. That is not how Computers work, since everything what you see on a screen is scaled via DPI. ---------------------------------------------------------------------- Emptyself · 2022-11-03 15:50 I beg to differ. Pixels should be only for «integer correction» and absolute reference. I want to dismiss the «pixel density» factor (depends on Pixel Pitch hardware constant!), of course and also taking into account some "border" conditions (again related to physical size of pixel… in this case if pixel size\pitch is greater than ⅓mm). I see it this way: get PixPitch of active monitor displays [PP1, PP2 etc.] on which monitor\s is 'Form' «window» at any moment (tracking)? PPFunction should act as a simple 'both way' convertor of [mm ←→ px] with integer round down to pixel und a float round down to 0.25mm (⅟₄mm). Then. if I have FHD «1920×1080» (p\mm rounded for our Function is 3p\mm, from 36p\cm) monitor and a 4K monitor «3840×2160» (p\mm rounded is 6p\mm, from 63p\cm), then an «icon» of size 5×5mm should take 15×15 pixels and 30×30 pixels respectively. Then inside that «icon» the text should resize accordingly… pets say with 1mm padding on each side… thut is 3p uand 6p respectively for each of the above monitors. Text, fonts (terminal\console windows) are also GUI! I have also came up with a name for this function: Fixel For example, my Dell 2K (UHD) monitor has a Pixel Pitch of 0.233mm physical dimensions (42p\cm ≈ 4p\mm)! width is 2560 pixels or 2560*0.233 = 596.48mm 596/5 = 119 icons (20×20 pixels) with min. size «readability» of 12p or 14p for text\font based GUI. 119*20 = 2380p but our monitor has 2560p width → 180p left 180p /20 = 9 «icons» of the same min. size total of 128 «icons», though we can use that space for grouping\separation That is how I want to do it. ---------------------------------------------------------------------- KodeZwerg · 2022-11-03 16:39 Quote from: Emptyself on November 03, 2022, 04:50:59 pmon which monitor\s is 'Form' «window» at any moment (tracking)?Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     Label1.Caption := Format('Monitor #%d: %d x %d @ %d',      [Screen.Monitors[Screen.MonitorFromWindow(Self.Handle, mdNearest).MonitorNum].MonitorNum,       Screen.Monitors[Screen.MonitorFromWindow(Self.Handle, mdNearest).MonitorNum].Width,       Screen.Monitors[Screen.MonitorFromWindow(Self.Handle, mdNearest).MonitorNum].Height,       Screen.Monitors[Screen.MonitorFromWindow(Self.Handle, mdNearest).MonitorNum].PixelsPerInch]);Maybe like that?... but i guess there are better ways. ---------------------------------------------------------------------- MarkMLl · 2022-11-03 17:16 Quote from: Emptyself on November 03, 2022, 04:50:59 pmI beg to differ. ... I see it this way: Tough. You've already said that your experience is limited, so listen to KodeZwerg who's got rather more. There's really two things here. The first is that the operating system will have its own facilities for displaying icons etc., and for performance reasons you'll find that much of that sort of thing is precomputed for "popular" sizes- 32x32, 48x48, 64x64 etc pixels... and you've not even bothered to tell us what OS you're running. Second, while OSes typically do try to have at least some awareness of DPI (pixels per inch etc.), if that's to be accurate it relies on the display device reporting its characteristics accurately... and since many devices particularly those at the lower end use commodity controller boards without configuration to suit the physical LCD panel etc. the reliability of that is limited. Now there's a couple of ongoing projects which attempt to reimplement a graphical subsystem on top of (basically) just a bitmapped display, and you could probably tweak those to suit the /measured/ (as distinct from reported) properties of your display device. But at best, you'd end up with application programs that looked like something from the 1980s, when practically every display library had its own visual style. So, I'm sorry to be negative and to have started off my response appearing to be downright hostile, but rather than writing science fiction you need to come to terms with the fact that the writers of the major widget sets- MS, Apple, and the GTK and Qt developers- do generally have some idea of what they're doing and don't go out of their way to be gratuitously awkward and inflexible. You will, of course, be able to find counterexamples: programs which "do their own thing" and still don't look too bad (things like Blender spring to mind, which at least in their early versions are forced to break new UI ground). But by and large you're stuck with the facilities that Lazarus (not to mention Delphi, Visual BASIC and so on) provide, and while these have matured to the point where you can lay out predefined widgets that autoscale in placement and size fairly painlessly, doing the same for the /content/ of the widgets (i.e. the precise size of every checkbox, caption and so on) is by and large infeasible. MarkMLl ---------------------------------------------------------------------- J-G · 2022-11-03 17:30 Quote from: Emptyself on November 03, 2022, 04:50:59 pmThat is how I want to do it.Well you can't !! I've recently done quite a lot of work in this area and found that Windows 'lies' about the DPI though it does return the correct V & H pixels. I needed a means by which the image on the screen and that output to a printer were genuinely 100%.  To do so I had to write a routine to [Calibrate] both Screen & Printer. This requires interaction from the user of course. For the screen; detailing the physical size of the Monitor or the pixel size specified by the manufacturer for the printer; feedback of physical size of the image printed. On my main PC Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   ScreenPPI.Caption:=IntToStr(Screen.PixelsPerInch);returns '96' but I know that the real PPI is 86.999. ---------------------------------------------------------------------- Emptyself · 2022-11-03 18:07 Well, to say I am a bit disappointed (and discouraged to learn how to code) would be too optimistic. I can not believe such a simple (and obvious!) thing has to be so complicated.  I wanted to learn how to code (Pascal ln Lazarus) by solving this problem I encountered, whilst conceptualising my application. I just want to base all my design around text\font\.svg elements and «bounding box» sizes. with maximum working area on the screen. I use Windows 10 Pro. From a first glance though it seems Linux has better handling for such concepts, but I am more familiar with Windows. Thought Pascal ln Lazarus could help me get this done and thus learn how to program. So disappointing  :'( really… ---------------------------------------------------------------------- MarkMLl · 2022-11-03 18:40 Well, whatever you're trying to do it's not going to be easy... at least by today's standards. OK, so blue sky ideas: you could start off by obliging the user to measure his screen: somebody else was discussing something like that a few days ago, but in his case it was- IIRC- because he had (loosely, reading between the lines) medical or assistive requirements. You could write, from scratch, a completely new widget set: i.e. the complete collection of dialog(ue) boxes, controls and groups thereof, and so on. To get anything like the functionality you want from scratch, that's going to take several man-years. And you could redo all text handling using e.g. Hershey fonts. But those were really targeted at vector displays and plotters, and you would find it extraordinarily difficult to get anything like the standard you get with conventional text rendering because of the amount of "hinting" built into modern typeface descriptions.. And at best, after years of work, you'd end up with something which was criticised mercilessly since like Java it didn't really look /right/ when run on a current computer. I sympathise. My own belief is that the industry would have been far better off sticking with text-based screens for another decade or so, but the lure of WYSIWYG wordprocessing and the lack of major TUI development tools with anything like the capabilities of VB and Delphi effectively put paid to that. MarkMLl ---------------------------------------------------------------------- KodeZwerg · 2022-11-03 19:42 Quote from: Emptyself on November 03, 2022, 07:07:25 pmWell, to say I am a bit disappointed (and discouraged to learn how to code) would be too optimistic. Okay, you can. Quote from: Emptyself on November 03, 2022, 07:07:25 pmI can not believe such a simple (and obvious!) thing has to be so complicated.  Because you thinking it in a wrong way. Millimeters you have on a paper but not on displays. Programs like Photoshop are simple lying to give you a feeling about having "real" mm measurement. Quote from: Emptyself on November 03, 2022, 07:07:25 pmI wanted to learn how to code (Pascal ln Lazarus) by solving this problem I encountered, whilst conceptualising my application. Concept of code (Software) and concept of Hardware are two things. Concept of code I showed you already but you somehow ignore it. Thats fine for me. Quote from: Emptyself on November 03, 2022, 07:07:25 pmI just want to base all my design around text\font\.svg elements and «bounding box» sizes. with maximum working area on the screen. And you can after you have understand how a display and a graphic-card is working together. Quote from: Emptyself on November 03, 2022, 07:07:25 pmI use Windows 10 Pro. From a first glance though it seems Linux has better handling for such concepts, but I am more familiar with Windows. With your windows experience tell me, at which place does windows tell you the matrix/raster of your internal display? When managed that, you still need to deal with a graphic drivers dpi configuration. When you got that both together, you finally can "compute" but anyway, your way of how you think that things should happen is wrong. ---------------------------------------------------------------------- Emptyself · 2022-11-03 19:45 OK, seems we have started to overcomplicate things. Questions: 1. can we get\ask the display driver\firmware to report the Pixel Pitch physical distance in mm, like we can do that for the resolution in pixels • I strongly believe that Pixel Pitch physical distance is a constant, otherwise the screens would have appeared wonky • thus this Pixel Pitch physical distance constant value for each active display should be somewhere and accessible! We need such a PPFunction {Fixel} as you can see below! Such function should depend on PixelPitch and ultimately to recommend min. initial value for font height on the current screen. ---------------------------------------------------------------------- KodeZwerg · 2022-11-03 20:02 Answers to your picture not your written text. Q:"...add buttons..." A: you need to change to borderless design of the form and create your own caption what emulate first of all the given basics (min/max/close/doubleclick/dragdrop etc)     - the "basic" caption is controlled by the operating system and not by the programmer Q:"...not a function..." A: Because you are not in a font property. Reading a manual might help. The key F1 can also be sometimes like magic. ---------------------------------------------------------------------- Emptyself · 2022-11-03 20:03 Quote from: KodeZwerg on November 03, 2022, 08:42:56 pm Quote from: Emptyself on November 03, 2022, 07:07:25 pmI can not believe such a simple (and obvious!) thing has to be so complicated.  Because you thinking it in a wrong way. Quote from: Emptyself on November 03, 2022, 07:07:25 pmI wanted to learn how to code (Pascal ln Lazarus) by solving this problem I encountered, whilst conceptualising my application. Concept of code I showed you already but you somehow ignore it. That's fine for me. Quote from: Emptyself on November 03, 2022, 07:07:25 pmI use Windows 10 Pro. From a first glance though it seems Linux has better handling for such concepts, but I am more familiar with Windows. With your windows experience tell me, at which place does windows tell you the matrix/raster of your internal display? When managed that, you still need to deal with a graphic drivers dpi configuration. When you got that both together, you finally can "compute" but anyway, your way of how you think that things should happen is wrong. Hi, KodeZwerg I did not ignore it, I simply do not understand it. OK… it seems it is English based but that's all I can get from it. And no, I do not think I am thinking it wrong. Resolution chosen should not affect my {Fixel} function. That is why it is called {Fixel} because it fixes a min. size of all text for readability. Then the user could simply increase it by ⅟₄mm (which would evaluate to 1p at least or 2p for 2K\4K monitors, maybe 3p for 8K and especially for mobile phones with high density pixels). Let's say my monitor is 4K. But I run it at «1920×1080». Nothing should change to the {Fixel} size of all tex\font based non–raster UI elements, panels, form fields, etc.! Such scale of resolution should only affect pixel based raster data\photos\textures\etc. ---------------------------------------------------------------------- Emptyself · 2022-11-03 20:25 Quote from: KodeZwerg on November 03, 2022, 09:02:07 pm Q:"...not a function..." A: Because you are not in a font property. Reading a manual might help. The key F1 can also be sometimes like magic. I do not want to change that font size though. I want the box of that drop down menu to respect the chosen font size. The tiny font in that info window probably can be increased somewhere in the Lazarus' settings, but I have much more crucial problem as explained in the OP (original post). ---------------------------------------------------------------------- domasz · 2022-11-03 20:32 How about % instead? Assume 100% = Screen.DesktopWidth, so Ratio = Screen.DesktopWidth / 100; If an element is supposed to be 5% x 10% in size then you just multiply 5*Ratio x 10*Ratio. ---------------------------------------------------------------------- Emptyself · 2022-11-03 20:46 Quote from: domasz on November 03, 2022, 09:32:47 pmHow about % instead? Assume 100% = Screen.DesktopWidth, so Ratio = Screen.DesktopWidth / 100; If an element is supposed to be 5% x 10% in size then you just multiply 5*Ratio x 10*Ratio. % are not very user friendly I am really OK with [mm] as they are good to visualise ½, ⅓, ⅟₄, even a tiny ⅟₅mm as well. For example my 12 years old 2K Dell has PP (Pixel Pitch) of about 0.233mm (roughly ⅟₄mm) There might be some 24" 2K monitors (ViewSonic VG2455-2K 2) with PP of 0.2~0.205mm (quite exactly ⅟₅mm)… It is really convenient to use [mm] for the function I want to have in my application. I think GPU should not make any scaling to such {Fixel}ed objects or rather treat them as being always in native display resolution. Because that is what this function will ask for as info: the PP (physical) of the current monitor hosting my current Form\window. ---------------------------------------------------------------------- KodeZwerg · 2022-11-03 20:49 Quote from: Emptyself on November 03, 2022, 09:46:01 pmFor example my 12 years old 2K Dell has PP (Pixel Pitch) of about 0.233mm (roughly ⅟₄mm) Again, where in windows do you see the "0.233" Value? ---------------------------------------------------------------------- marcov · 2022-11-03 20:51 High performance scalable fonts has been done for opengl, search for "signed distance field".  Correlating to mm is hard, because the PPI info of OEM monitors is often quite coarse (a generic xxx inch monitor) or completely erroneous (e.g. from a different model in the same series). It should be accessable via the forms.screens[]  array.  You might also want to try to mine https://www.pascalgamedevelopment.com/content.php for useful snippets of Game UIs. ---------------------------------------------------------------------- Emptyself · 2022-11-03 20:56 Quote from: KodeZwerg on November 03, 2022, 09:49:16 pmQuote from: Emptyself on November 03, 2022, 09:46:01 pmFor example my 12 years old 2K Dell has PP (Pixel Pitch) of about 0.233mm (roughly ⅟₄mm) Again, where in windows do you see the "0.233" Value? That is the problem! The manufacturers have it, seems Microsoft are more busy monitoring my PC telemetry data, than acting really as a true OS! https://www.displayspecifications.com/en/ That is why I want to create\develop {Fixel} ---------------------------------------------------------------------- Emptyself · 2022-11-03 21:02 Quote from: marcov on November 03, 2022, 09:51:04 pmHigh performance scalable fonts has been done for opengl, search for "signed distance field".  Correlating to mm is hard, because the PPI info of OEM monitors is often quite coarse (a generic xxx inch monitor) or completely erroneous (e.g. from a different model in the same series). It should be accessable via the forms.screens[]  array.  You might also want to try to mine https://www.pascalgamedevelopment.com/content.php for useful snippets of Game UIs. I think you overestimate my competence in this field. I had to search online what OpenGL is…  I do agree. PPI is dumb… actually quite misleading. Pixel Pitch is what should be reported to the OS by a driver\firmware! ---------------------------------------------------------------------- marcov · 2022-11-03 21:03 Quote from: Emptyself on November 03, 2022, 10:02:36 pmI think you overestimate my competence in this field. I had to search online what OpenGL is…  Then I suggest to use Lazarus as is till you are more competent ---------------------------------------------------------------------- KodeZwerg · 2022-11-03 21:07 Quote from: Emptyself on November 03, 2022, 09:56:57 pmQuote from: KodeZwerg on November 03, 2022, 09:49:16 pmQuote from: Emptyself on November 03, 2022, 09:46:01 pmFor example my 12 years old 2K Dell has PP (Pixel Pitch) of about 0.233mm (roughly ⅟₄mm) Again, where in windows do you see the "0.233" Value? That is the problem! The manufacturers have it, seems Microsoft are more busy monitoring my PC telemetry data, than acting really as a true OS! https://www.displayspecifications.com/en/ Because to display something you simply do not need that information. All you need to know is the dimension and dpi/ppi, with that information you can do all the things that you have in your mind by discarding the thinking that a pixel on your display has "with a ruler attached on that display" a mm-value of whatever, it simple does not matter how much mm is anything since a display does not count in such. I am just honest, sorry to ruin or disappoint your thinking. (Even getting the correct dpi can be a struggle... trust me) ---------------------------------------------------------------------- MarkMLl · 2022-11-03 21:12 Quote from: Emptyself on November 03, 2022, 10:02:36 pmI think you overestimate my competence in this field. I had to search online what OpenGL is…  In that case stop fantasizing that what you think ought to happen is what's really happening, and listen to people who are trying to help you. I'm sorry, but if you had any idea /at/ /all/ how many times I've had to listen to this sort of thing over the last 40 years or so... "I'm sure my car should be able to fly. Where do I find the hover control?". MarkMLl ---------------------------------------------------------------------- Emptyself · 2022-11-03 21:12 Quote from: KodeZwerg on November 03, 2022, 10:07:55 pmQuote from: Emptyself on November 03, 2022, 09:56:57 pmQuote from: KodeZwerg on November 03, 2022, 09:49:16 pmQuote from: Emptyself on November 03, 2022, 09:46:01 pmFor example my 12 years old 2K Dell has PP (Pixel Pitch) of about 0.233mm (roughly ⅟₄mm) Again, where in windows do you see the "0.233" Value? That is the problem! The manufacturers have it, seems Microsoft are more busy monitoring my PC telemetry data, than acting really as a true OS! https://www.displayspecifications.com/en/ Because to display something you simply do not need that information. All you need to know is the dimension and dpi/ppi, with that information you can do all the things. (Even getting the correct dpi can be a struggle... trust me) Well, seems facts (at least in MS Windows) speak of the contrary… of course I need that Pixel Pitch tech info in [mm]! PPI\DPI is nonsense! ---------------------------------------------------------------------- Emptyself · 2022-11-03 21:16 Quote from: MarkMLl on November 03, 2022, 10:12:31 pmQuote from: Emptyself on November 03, 2022, 10:02:36 pmI think you overestimate my competence in this field. I had to search online what OpenGL is…  In that case stop fantasizing that what you think ought to happen is what's really happening, and listen to people who are trying to help you. "I'm sure my car should be able to fly. Where do I find the hover control?". MarkMLl But we are not talking about new\modified hardware, rather about a simple tech. spec already available and quite firm as a constant; also extremely valuable and important. ---------------------------------------------------------------------- MarkMLl · 2022-11-03 21:26 Quote from: Emptyself on November 03, 2022, 10:16:13 pmBut we are not talking about new\modified hardware, rather about a simple tech. spec already available and quite firm as a constant; also extremely valuable and important. But that's not how people have done it over the last 35 years or so, ever since GUIs started hitting the mass market. You'd have to start reimplementing a massive amount of code from the bottom up, and you'd still have the fundamental problem that you can't rely on screens reporting their parameters accurately. MarkMLl ---------------------------------------------------------------------- domasz · 2022-11-03 21:30 Quote from: Emptyself on November 03, 2022, 10:16:13 pmrather about a simple tech. spec already available and quite firm as a constant; also extremely valuable and important. Where available? I have a generic driver installed for my laptop's monitor. There is no way to get real DPI from that driver. Windows just assumes it is 96 dpi. And OS doesn't care if your screen resolution (eg. 1920x1080) is rendered on a 13" monitor of 42" simply because it's not important. ---------------------------------------------------------------------- KodeZwerg · 2022-11-03 21:33 Quote from: Emptyself on November 03, 2022, 10:12:46 pmPPI\DPI is nonsense!Of course you can have your own opinion about how a computer display and graphic adapter/drivers etc shall work but that's just you. Integer are numbers, what is integer for 0.233. 0 or 1? I hope this will open your eyes to rethink about all. I am wishing you good luck to invent something that does never work generic and is unprecise / unpredictable. Do not explain me that it's precise since it ain't. Maybe on a paper but not on a display. ---------------------------------------------------------------------- Emptyself · 2022-11-03 22:03 Quote from: KodeZwerg on November 03, 2022, 10:33:49 pmQuote from: Emptyself on November 03, 2022, 10:12:46 pmPPI\DPI is nonsense! Do not explain me that it's precise since it ain't. Maybe on a paper but not on a display. Are you serious?  Pixel Pitch data quite exactly corresponds to a size of a pixel… thut is 1 (one) integer pixel. Its size in mm is not an integer but it does not have to be. In displays with desktop size (22~24" so called diagonal) and big pixels «low res» e.g. 1024×768 (hardly on the market anymore) the physical min. requirement for readability will thus be just one or two pixel above 3mm Capital letter size, because of the bare minimum for modern .ttf fonts. So those 12 pixels might end up at 3.5~4mm. Big deal…  But with {Fixel} on the 4K monitor all and every font ever parsed by the {Fixel} implementation, will end up about the same physical size on any «better» monitor. I am amazed that it is almost 2023 and this is still a problem. {Fixel} should be user controlled adjustable, regardless of non native resolution (OS graphic driver tweaked). I am so angry at myself for not having a proper computer programming surrounding (a lack of it actually), by 2001 all this should have been solved. ---------------------------------------------------------------------- itblumi · 2022-11-03 22:13 Dude ok then you can get the information from the WMIObject, but not all monitors will provide this data. So you can make a database with all those values foreach model and for all monitors or you ask the user if he would measure the size of his monitor before. 3 Solution is to call each producer of monitors and tell them they have to provide this information, good luck with this! 4th is what do you do if some uses a projector ? Do you ask him if he measures the distance between the wall and the projector ? ---------------------------------------------------------------------- Emptyself · 2022-11-03 22:37 Quote from: itblumi on November 03, 2022, 11:13:27 pmDude ok then you can get the information from the WMIObject, but not all monitors will provide this data. So you can make a database with all those values foreach model and for all monitors or you ask the user if he would measure the size of his monitor before. 3 Solution is to call each producer of monitors and tell them they have to provide this information, good luck with this! 4th is what do you do if some uses a projector ? Do you ask him if he measures the distance between the wall and the projector ? Projectors just project\magnify proportionally (well, with some small persp. distortion). The setup happens before the projector. Nevermind… at least it reminds me why I did not pursue computer programming, so I just went for Design Engineering. ---------------------------------------------------------------------- KodeZwerg · 2022-11-03 22:44 Quote from: Emptyself on November 03, 2022, 11:03:52 pmQuote from: KodeZwerg on November 03, 2022, 10:33:49 pmQuote from: Emptyself on November 03, 2022, 10:12:46 pmPPI\DPI is nonsense! Do not explain me that it's precise since it ain't. Maybe on a paper but not on a display. Are you serious?  Yes. https://techterms.com/definition/dpi Your pixel pitch, fixel and whatever else you are naming and all your calculation formulas (that are working on a paper) is on a display from side of software worth nothing. Believe it or let it be, DPI plus Dimension is how your display works. It was a nice talk, I am out, as said, good luck with your invention. ---------------------------------------------------------------------- Emptyself · 2022-11-03 23:16 Quote from: KodeZwerg on November 03, 2022, 11:44:23 pmQuote from: Emptyself on November 03, 2022, 11:03:52 pmQuote from: KodeZwerg on November 03, 2022, 10:33:49 pmQuote from: Emptyself on November 03, 2022, 10:12:46 pmPPI\DPI is nonsense! Do not explain me that it's precise since it ain't. Maybe on a paper but not on a display. Are you serious?  Yes. https://techterms.com/definition/dpi Your pixel pitch, fixel and whatever else you are naming and all your calculation formulas (that are working on a paper) is on a display from side of software worth nothing. Believe it or let it be, DPI plus Dimension is how your display works. It was a nice talk, I am out, as said, good luck with your invention.  DPI is arbitrary convention. What is a Dot, also what is a Point? They did not know better back in the day trying to unify dot matrix printers and early «pixel» monitors. The bitmaps were produced «bigger» then scaled down to look more detailed, in a similar fashion to how post card artist draw them 2~3 times bigger than the printed size. As if that would be the only thing Microsoft will do wrongly. Now we have DPI Scaling. And is it too late to Fix‑el it? ---------------------------------------------------------------------- VTwin · 2022-11-04 01:20 Too late? You should prepare a draft of the specifications for your fixel, and send it off to all the software and hardware manufacturers. Who knows? ---------------------------------------------------------------------- J-G · 2022-11-04 02:23 Quote from: Emptyself on November 03, 2022, 08:45:54 pmOK, seems we have started to overcomplicate things.No  --  these things ARE complicated. Moreso because very early on, Bill Gates 'decreed' that there would be 100 points to the inch, trying to overturn centuries of history where 72.27 points to the inch had morphed to a rounded 72 which is what it really is today. We are still being hounded by this fool-hardy attempt to control the world which is why you don't understand what's going on with the font size/text height figures. **nix systems are no better since they rely on the 'old ways' at the core. Quote from: EmptyselfQuestions: 1. can we get\ask the display driver\firmware to report the Pixel Pitch physical distance in mm, like we can do that for the resolution in pixelsAgain No -  this time because each monitor manufacturer makes commercial decisions without consideration for irrelevant user convenience. Quote from: Emptyself• I strongly believe that Pixel Pitch physical distance is a constant, otherwise the screens would have appeared wonky • thus this Pixel Pitch physical distance constant value for each active display should be somewhere and accessible!Regrettably it isn't, primarily because there is no incentive for each manufacturer to provide such. I'm not sure that they are still extant but there was certainly a time when some monitors had three separate 'oblong' elements - R,G & B - for each 'pixel'. Quote from: EmptyselfWe need such a PPFunction {Fixel} as you can see below! Such function should depend on PixelPitch and ultimately to recommend min. initial value for font height on the current screen.YOU might think that you NEED such but in the real world, that most of us inhabit, we have learned to live with what we have. In my first post, I explained how I'd got around the perceived problem. Incidentally, I always work in mm for both Screen display and physical printed output  - - -  I've developed appropriate algorithms for conversion  -  it's quite simple arithmetic. ---------------------------------------------------------------------- loaded · 2022-11-04 06:05 Yes, Screen.PixelsPerInch gives incorrect results when it is necessary to take measurements from the screen with a ruler in scaled drawing projects. Calculating this value manually according to the monitor properties and using it instead of Screen.PixelsPerInch gives a very accurate result. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button1Click(Sender: TObject);var  l1,l2:TPoint;  length_cm:double=10; // cmbegin    Caption:=Screen.PixelsPerInch.ToString;     l1.x:=100;l1.y:=100;    l2.x:=100+trunc((length_cm/2.54)*Screen.PixelsPerInch);l2.y:=100;    canvas.pen.Width:=3;    canvas.pen.Color:=clRed;    canvas.Line(l1,l2);     l1.x:=100;l1.y:=130;                                                                                      //1920x1080 21.5 inch screen    l2.x:=100+trunc((length_cm/2.54)*102.46 {Screen.PixelsPerInch});l2.y:=130;   //https://www.sven.de/dpi/      canvas.pen.Width:=3;     canvas.pen.Color:=clGreen;     canvas.Line(l1,l2);  end; ---------------------------------------------------------------------- KodeZwerg · 2022-11-04 07:34 Quote from: loaded on November 04, 2022, 07:05:12 amYes, Screen.PixelsPerInch gives incorrect results when it is necessary to take measurements from the screen with a ruler in scaled drawing projects. Calculating this value manually according to the monitor properties and using it instead of Screen.PixelsPerInch gives a very accurate result. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button1Click(Sender: TObject);var  l1,l2:TPoint;  length_cm:double=10; // cmbegin    Caption:=Screen.PixelsPerInch.ToString;     l1.x:=100;l1.y:=100;    l2.x:=100+trunc((length_cm/2.54)*Screen.PixelsPerInch);l2.y:=100;    canvas.pen.Width:=3;    canvas.pen.Color:=clRed;    canvas.Line(l1,l2);     l1.x:=100;l1.y:=130;                                                                                      //1920x1080 21.5 inch screen    l2.x:=100+trunc((length_cm/2.54)*102.46 {Screen.PixelsPerInch});l2.y:=130;   //https://www.sven.de/dpi/      canvas.pen.Width:=3;     canvas.pen.Color:=clGreen;     canvas.Line(l1,l2);  end; This and his calculation only works if your display is configured at a 100% scaling, what is rare nowadays with big displays like I use (8k ultra wide) Those calculations you only can use when you setup your own video- mode. ---------------------------------------------------------------------- loaded · 2022-11-04 07:48 Quote from: KodeZwerg on November 04, 2022, 08:34:06 amThis and his calculation only works if your display is configured at a 100% scaling, what is rare nowadays with big displays like I use (8k ultra wide) Those calculations you only can use when you setup your own video- mode. Yes you are right, For simplicity, I have given the code above as an example. (in the cartographer's terms, 1 millimeter on the screen at 1/1000 scale corresponds to 1 meter in land) Our application at work has additional calculations related to scaling so we can get the right result in enlargement and reduction operations. ---------------------------------------------------------------------- MarkMLl · 2022-11-04 08:16 Quote from: Emptyself on November 04, 2022, 12:16:15 amThey did not know better back in the day trying to unify dot matrix printers and early «pixel» monitors. The bitmaps were produced «bigger» then scaled down to look more detailed, in a similar fashion to how post card artist draw them 2~3 times bigger than the printed size. Rubbish. Let's look at some history. Leaving aside for the moment printing typewriters of various kinds, and text-only displays (which invariably worked by having a ROM containing a 1:1 map of the pixels required for each character), the first graphical displays were vector-based e.g. the Tektronix storage tubes. However as the concept of graphical UIs spread out from Xerox PARC, there was a near-universal agreement that these would use a bitmapped display: the Alto's display was bitmapped as was the Interim Dynabook, and the graphics handling relied heavily on the bitblt algorithm. Early reviewers of Xerox's work included both Apple and Tektronix, and it is crucial to understand that Tek used a bitmapped display for the implementation, not one of their vector-based storage tubes. Some PC-class equipment had hardware capabilities for drawing vectors, but because the physical output device (a CRT) was raster-based, it was far easier (and cheaper) to have a 1:1 mapping between a bitmap and what was seen on the screen and to leave it to software. And by and large, computers also had a 1:1 mapping between a character buffer and the screen, and PCs (but not necessarily other workstations such as Sun) started up in a text mode even if they later flipped to a graphical presentation. Many early PC programs actually ran in text mode, and drew furniture (window outlines, scrollbars etc.) using whatever characters were available in the standard font. By the time of the VGA, it was possible to define a 512-character typeface by sacrificing one of the attribute bits, and I have seen that used to good effect to implement window borders with curved edges etc. However it is important to appreciate that there was still a 1:1 mapping between pixels defined in the typeface, and pixels on the screen. When people started working entirely in graphical modes, they continued to design furniture and glyphs using precise bitmaps. On PCs that was because of the legacy of a 1:1 mapping from characters to the screen, on workstations that was at least in part due to the legacy of the bitblt algorithm. So if you look at the Apple Lisa, at DR GEM or Windows pre-'95, you will see that every glyph has been tailored to obtain an unambiguous high-contrast result, and if you look deeper you will find that the glyphs comprise two colours and are stored with a fixed size. In the Windows 3.1 and Windows '95 era, this started to break down. First, Windows adopted TrueType fonts (after a flirtation with Adobe) which were rendered from strokes with hints (pioneered by Knuth). Second, entirely as eye-candy, there was a tendency to design icons etc. at a higher-resolution than would be eventually required and then to "downsample" them to suit a limited number of expected resolutions... by and large this had to be done manually, and it also had a major effect on the use of stored colours etc. But still, due to the bitmapped legacy, UIs were designed as pixel maps: windows (forms in programming terms) had a size in pixels. This even applies to web design etc.: while it might be possible to aspire to absolute measurements this is entirely dependent on getting a set of accurate display measurements, and this is so rare that nobody has attempted to redesign the entire software architecture to be based on it. I was there, I've seen this stuff happening. I'm an engineer, and have some idea of how the World works. And I'm proud of that. So, Mr. Design Engineer, your choice is simple. You either listen to what you're being told, and try to explain to us what you're actually trying to do: you might be surprised at how enthusiastic people are likely to be to help you, particularly after a rough start. Or alternatively you crawl back into your offshoot of Social Sciences and spend the rest of your life frustrated that the Universe doesn't behave like your carefully-crafted theories say it ought. MarkMLl ---------------------------------------------------------------------- Emptyself · 2022-11-04 10:07 Quote from: MarkMLl on November 04, 2022, 09:16:04 amYou either listen to what you're being told, and try to explain to us what you're actually trying to do: you might be surprised at how enthusiastic people are likely to be to help you, particularly after a rough start. MarkMLl I would like to build an app very similar to a GuitarTab notation but it can function as a «TAB» for any instrument. And it is 100% text\font based. Because of the nature of it, I need as much screen real estate as possible (as any Music reader) to avoid «turning pages» (scrolling) as much as possible. That is why I need it to be independent of «DPI Scaling» or non‑native screen resolutions (though we could agree that anything below 1024×768 is now obsolete, mainly tablets… for laptops\notebooks it is 1366×768 as a minimum). The main goals are: 1. optimal readability with… 2. as much screen estate as possible with… 3. minimalistic but present UI elements (buttons\icons) All text\font\svg based. I will open a new thread «here: Building Music Tablature notation (text\font based)» for this request. But I really would prefer to learn how to code it myself as well. ---------------------------------------------------------------------- MarkMLl · 2022-11-04 10:19 Right, I think that's a good one. Let's try to put this early banter behind us and move forwards in the other thread. I know that there's music viewers used by- in particular- the organist community, who these days are highly oriented towards having a computer between the console and actuators. It might be worth checking whether anything there has a half-decent implementation... and I'd say early on that even if that turns out to be written in something obnoxious like Python the existence of a foundation project should influence your choice of language. MarkMLl ---------------------------------------------------------------------- WayneSherman · 2022-11-07 18:20 Since 1994 the VESA DDC / EDID specification has defined a mechanism for display devices (e.g. monitors) to provide device information to a video source (e.g. a graphics card in a computer).  Sometimes this information is not complete or not accurate, in which case you should have a way for a user to manually provide the display size and pixel resolution to calculate the pixel pitch (or use a calibration procedure as recommended by loaded). References: https://en.wikipedia.org/wiki/Extended_Display_Identification_Data https://www.extron.com/article/uedid https://superuser.com/questions/1258288/can-monitors-send-the-dpi-info On Windows, the EDID information is queried and stored in the registry for each display device: https://superuser.com/questions/1597994/does-windows-know-physical- size-of-external-monitor https://www.nirsoft.net/utils/monitor_info_view.html There are several options for reading and decoding the information (these can be adapted to work with FPC/Lazarus): https://ofekshilon.com/2011/11/13/reading-monitor-physical-dimensions- or-getting-the-edid-the-right-way/ https://www.nirsoft.net/utils/dump_edid.html https://stackoverflow.com/questions/4322153/how-to-query-native- hardware-resolution-of-primary-monitor-in-windows https://social.technet.microsoft.com/Forums/ie/en- US/7b5d5752-e032-4801-aa7d-3099873dd518/retrieve-edid-data-monitor- display-device-tft-crt-name-or-model-in-powershell?forum=ITCG ---------------------------------------------------------------------- domasz · 2022-11-07 19:40 Quote from: WayneSherman on November 07, 2022, 07:20:18 pmhttps://stackoverflow.com/questions/4322153/how-to-query-native- hardware-resolution-of-primary-monitor-in-windows Nice info! Here's what I did. Works on Delphi and Lazarus. Returns PPI correctly for me: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses ..., Variants, Math, ActiveX, Registry, ComObj; type  TMonitorInfo = record    ResolutionV: Integer;    ResolutionH: Integer;    SizeV: Integer;    SizeH: Integer;    PPI: Extended;    Diagonal: Extended;  end; ...  function GetMonitorId: String;const wbemFlagForwardOnly = $00000020;var Locator: OLEVariant;    Service: OLEVariant;    ObjectSet: OLEVariant;    Monitor: OLEVariant;    Enum: IEnumvariant;    Value: LongWord;begin;  Locator := CreateOleObject('WbemScripting.SWbemLocator');  Service := Locator.ConnectServer('localhost', 'root\CIMV2', '', '');  ObjectSet := Service.ExecQuery('SELECT * FROM Win32_DesktopMonitor','WQL',wbemFlagForwardOnly);  Result := '';   Enum  := IUnknown(ObjectSet._NewEnum) as IEnumVariant;  if Enum.Next(1, Monitor, Value) = 0 then begin    if not VarIsNull(Monitor.PNPDeviceID) then Result := String(Monitor.PNPDeviceID);    Monitor := Unassigned;  end;end; function GetMonitorInfo: TMonitorInfo;const dtd = 54;var Reg: TRegistry;    Res: Boolean;    RegKey: AnsiString;    Size: Integer;  EDID: array of Byte;    Diag: Extended;begin  RegKey := 'SYSTEM\CurrentControlSet\Enum\' + GetMonitorId + '\Device Parameters';   FillChar(Result, SizeOf(Result), 0);   Reg := TRegistry.Create(KEY_READ);  try    Reg.RootKey := HKEY_LOCAL_MACHINE;    Res := Reg.OpenKey(RegKey, false);     if Res then begin      Size := Reg.GetDataSize('EDID');       if (Size > 0) then begin        SetLength(EDID, Size);        Reg.ReadBinaryData('EDID', EDID[0], Size);         Result.ResolutionH := ((edid[dtd+4] shr 4) shl 8) or edid[dtd+2];        Result.ResolutionV := ((edid[dtd+7] shr 4) shl 8) or edid[dtd+5];       Result.SizeH := edid[21];        Result.SizeV := edid[22];         Diag := Sqrt(Result.SizeH*Result.SizeH + Result.SizeV*Result.SizeV);      Result.Diagonal := Diag * 1/2.54;        Result.PPI := sqrt(Result.ResolutionH*Result.ResolutionH + Result.ResolutionV*Result.ResolutionV) / Result.Diagonal;      end;  end;  finally    Reg.Free;  end;end;  procedure TForm1.Button1Click(Sender: TObject);var Info: TMonitorInfo;begin  Info := GetMonitorInfo;   Memo1.Lines.Add( Format('Resolution: %d x %d', [Info.ResolutionV, Info.ResolutionH]) );  Memo1.Lines.Add( Format('Size: %d x %d', [Info.SizeV, Info.SizeH]) );  Memo1.Lines.Add( Format('Diag: %f "', [Info.Diagonal]) );  Memo1.Lines.Add( Format('PPI: %f ', [Info.PPI]) );end; ---------------------------------------------------------------------- WayneSherman · 2022-11-07 20:19 Quote from: WayneSherman on November 07, 2022, 07:20:18 pmOn Windows, the EDID information is... Linux also has various ways to get the monitor EDID info: https://unix.stackexchange.com/questions/114359/how-to-get-edid-for-a- single-monitor ---------------------------------------------------------------------- MarkMLl · 2022-11-07 20:45 Quote from: WayneSherman on November 07, 2022, 09:19:57 pmLinux also has various ways to get the monitor EDID info: https://unix.stackexchange.com/questions/114359/how-to-get-edid-for-a- single-monitor I've used edid-decode before now, but noting one of the comments in that thread I had to get the upstream version since the one supplied by Debian was... not exactly up to date. If my memory serves correctly that was in conjunction with a program supplied by Raspbian (or whatever they call it these days), which used a backdoor to get the current state of the (non-Linux) video subsystem. BUT, as I've said earlier in this discussion, that's /entirely/ dependent on the monitor's firmware knowing- and being bothered to report- the parameters of the physical display device to which it is attached. And since both monitor display boards and (LCD) display panels are largely commodity devices based around a standardised interface, that is by no means assured. Particularly if dealing with a display which is TV-like rather than being dedicated to the role of a desktop monitor, the "added value" and distinguishing features are the onboard software which support "painless" subscription to Netflix etc., not the sophistication of the display controller. MarkMLl ---------------------------------------------------------------------- domasz · 2022-11-07 22:12 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses MonitorInfo; procedure TForm1.Button1Click(Sender: TObject);var Info: TMonitorInfo;begin  Info := GetMonitorInfo;   Memo1.Lines.Add( Format('Resolution: %d x %d', [Info.ResolutionH, Info.ResolutionV]) );  Memo1.Lines.Add( Format('Size: %d x %d', [Info.SizeH, Info.SizeV]) );  Memo1.Lines.Add( Format('Diag: %f "', [Info.Diagonal]) );  Memo1.Lines.Add( Format('PPI: %f ', [Info.PPI]) );  Memo1.Lines.Add( Format('Dot Pitch: %f ', [Info.DotPitch]) );  Memo1.Lines.Add( Format('Aspect Ratio: %f ', [Info.AspectRatio]) );   Memo1.Lines.Add( Format('Year: %d ', [Info.ManufactureYear]) );  Memo1.Lines.Add( Format('Manufacturer: %s ', [Info.Manufacturer]) );end; ---------------------------------------------------------------------- KodeZwerg · 2022-11-07 22:34 Quote from: domasz on November 07, 2022, 11:12:37 pmCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses MonitorInfo; procedure TForm1.Button1Click(Sender: TObject);var Info: TMonitorInfo;begin  Info := GetMonitorInfo;   Memo1.Lines.Add( Format('Resolution: %d x %d', [Info.ResolutionH, Info.ResolutionV]) );  Memo1.Lines.Add( Format('Size: %d x %d', [Info.SizeH, Info.SizeV]) );  Memo1.Lines.Add( Format('Diag: %f "', [Info.Diagonal]) );  Memo1.Lines.Add( Format('PPI: %f ', [Info.PPI]) );  Memo1.Lines.Add( Format('Dot Pitch: %f ', [Info.DotPitch]) );  Memo1.Lines.Add( Format('Aspect Ratio: %f ', [Info.AspectRatio]) );   Memo1.Lines.Add( Format('Year: %d ', [Info.ManufactureYear]) );  Memo1.Lines.Add( Format('Manufacturer: %s ', [Info.Manufacturer]) );end;I am getting strange results with your unit. ---------------------------------------------------------------------- domasz · 2022-11-07 22:37 Quote from: KodeZwerg on November 07, 2022, 11:34:50 pmI am getting strange results with your unit. I only have one monitor so perhaps it's not getting the active monitor for you? Size is given in cm, Diagonal in inches, Aspect Ratio is 1:{RETURNED VALUE}, Manufacturer is always just 3 letters. What values should it list in your case? ---------------------------------------------------------------------- domasz · 2022-11-07 22:57 Updated a bit Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses MonitorInfo; procedure TForm1.Button1Click(Sender: TObject);var Info: TMonitorInfo;begin  Info := GetMonitorInfo;   Memo1.Lines.Add( Format('Resolution: %d x %d px', [Info.ResolutionH, Info.ResolutionV]) );  Memo1.Lines.Add( Format('Size: %d x %d cm', [Info.SizeH, Info.SizeV]) );  Memo1.Lines.Add( Format('Diag: %f inch', [Info.Diagonal]) );  Memo1.Lines.Add( Format('PPI: %f ', [Info.PPI]) );  Memo1.Lines.Add( Format('Dot Pitch: %f mm', [Info.DotPitch]) );  Memo1.Lines.Add( Format('Aspect Ratio: %f:1 ', [Info.AspectRatio]) );   Memo1.Lines.Add( Format('Year: %d ', [Info.ManufactureYear]) );  Memo1.Lines.Add( Format('Manufacturer: %s ', [Info.Manufacturer]) );end; ---------------------------------------------------------------------- KodeZwerg · 2022-11-07 22:58 Resolution: 7680 x 4320 Size: (no ruler at hand) Diag: 55" PPI: 160,21 Dot Pitch: 0,1586 Aspect Ratio: 16:9 Year: 2021 Manufacturer: (I do not know the 3 digits, maybe GSM was correct) ---------------------------------------------------------------------- domasz · 2022-11-07 23:04 Quote from: KodeZwerg on November 07, 2022, 11:58:48 pmResolution: 7680 x 4320 Size: (no ruler at hand) Diag: 55" PPI: 160,21 Dot Pitch: 0,1586 Aspect Ratio: 16:9 Year: 2021 Manufacturer: (I do not know the 3 digits, maybe GSM was correct) Thank you. It returned weird values for Size and Resolution and then calculated a few other things based on these values. I'll read more about EDID, maybe it can be fixed. Or maybe just your monitor is not reporting correctly the values. GSM is "Goldstar Company Ltd". The updated unit (above) shows full names instead of 3-letter company codes. ---------------------------------------------------------------------- KodeZwerg · 2022-11-07 23:13 Thank you for your update, ASU should be my 3 digit code. Display is capable of 8k but for testing I changed the resolution, it returns always same, have you tried to change display resolution or dpi factor? ---------------------------------------------------------------------- domasz · 2022-11-07 23:42 Quote from: KodeZwerg on November 08, 2022, 12:13:59 amThank you for your update, ASU should be my 3 digit code. Please run the code below and tell me the values reported by   Memo1.Lines.Add( Format('A+B: %d %d', [Info.A, Info.B]) );   Memo1.Lines.Add( Format('PNP: %s', [Info.PNPID]) ); I can't find a reason why Manufacturer would be reported incorrectly. Can you tell me your monitor make and model? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button1Click(Sender: TObject);var Info: TMonitorInfo;begin  Info := GetMonitorInfo;   Memo1.Lines.Add( Format('Resolution: %d x %d px', [Info.ResolutionH, Info.ResolutionV]) );  Memo1.Lines.Add( Format('Size: %d x %d cm', [Info.SizeH, Info.SizeV]) );  Memo1.Lines.Add( Format('Diag: %f inch', [Info.Diagonal]) );  Memo1.Lines.Add( Format('PPI: %f ', [Info.PPI]) );  Memo1.Lines.Add( Format('Dot Pitch: %f mm', [Info.DotPitch]) );  Memo1.Lines.Add( Format('Aspect Ratio: %f:1 ', [Info.AspectRatio]) );   Memo1.Lines.Add( Format('Year: %d ', [Info.ManufactureYear]) );  Memo1.Lines.Add( Format('Manufacturer: %s ', [Info.Manufacturer]) );   Memo1.Lines.Add( Format('A+B: %d %d', [Info.A, Info.B]) );  Memo1.Lines.Add( Format('PNP: %s', [Info.PNPID]) );end; ---------------------------------------------------------------------- VisualLab · 2022-11-08 01:14 A very useful module. On my hardware (monitor) it works fine. The results read from the system agree with the actual results. I measured the size of the working area (W x H) with a tape measure. ---------------------------------------------------------------------- WayneSherman · 2022-11-08 01:42 Quote from: KodeZwerg on November 07, 2022, 11:58:48 pmResolution: 7680 x 4320 Very high resolution displays are relatively recent technology.  The original EDID data structures only defined 12 bits for horizontal and vertical active pixels (max resolution = 4096 x 4096).  To represent a larger resolution display, the manufacture must include an extension block in the EDID data. EIA/CEA-861 extension block A EIA/CEA-861 extension block can use a Short Video Descriptor (SVD) and Video Identification Code (VIC).  See the table "IA/CEA-861 standard resolutions and timings", VIC #194 to #209 here: https://en.wikipedia.org/wiki/Extended_Display_Identification_Data#CEA -861-E NOTE:  Only recently did HDMI support a CEA-861 resolution of 7680x4320 - "The CTA-861-G standard has the full list of 154 (1–127, 193–219) short video descriptors above. It is used by HDMI 2.1." DisplayID extension block A DisplayID extension block can also represent >4096 pixel resolution.  DisplayID is a newer VESA standard designed to replace / extend EDID structure v1.4.  DisplayID v1.3 and v2.0 can use 16 bits to represent horizontal and vertical pixel count and both versions can also use a VIC code to represent a video mode / resolution. https://en.wikipedia.org/wiki/DisplayID CRU utility for Windows The EDID, DisplayID, and other extension block data structures can be manipulated (read, export, edit, create, etc) using the open source CRU utility: https://www.monitortests.com/forum/Thread-Custom-Resolution-Utility- CRU (this utility also allows editing the EDID stored in the registry and can be used to force custom display modes for a monitor) If @KodeZwerg wants to use CRU to export his EDID data, he can post or send the file and @domasz can analyze it using CRU and test his code with it. ---------------------------------------------------------------------- WayneSherman · 2022-11-08 16:20 Quote from: WayneSherman on November 08, 2022, 02:42:34 amVery high resolution displays are relatively recent technology.  The original EDID data structures only defined 12 bits for horizontal and vertical active pixels (max resolution = 4096 x 4096).  To represent a larger resolution display, the manufacture must include an extension block in the EDID data. The EDID / DisplayID shows what video modes the monitor supports, but not the current mode that is actually in use.  So to calculate the current pixel pitch it would be better (and simpler) to use the current desktop/screen resolution (screen.width, screen.height or EnumDisplaySettings) and use the display size from the EDID. ---------------------------------------------------------------------- Emptyself · 2022-11-09 00:05 This discussion became extremely advanced (at least to me)… So I just wanted to make the clarification that «resolution» dos not matter (that much). What is most relevant here is actual physical size of pixels and consecutively the so called density measured in PPI (for some unknown reason), described as DPI (for even a more obscure reason, because dots could vary in size «halftoning», whilst physical pixel can not). This, since the beginning of RGB physical pixel (LCD\IPS) tech. and 1:1 pixel aspect ratio , should have been related to mm, cm and dm. 10mm = 1cm 100mm = 1dm If the manufacturers could not make their pixel size\pitch a simple fraction of a mm, e.g. ½ (0.5)mm, ⅓ (0.333…), , ⅟₄ (0.25), ⅟₅ (0.2), ⅟₆ (0.1666…), ⅟₇ (this one is tough), ⅟₈ (0.125), ⅟₉ (0.111…), ⅟₁₀ (0.1)mm then var pixelPitch : real pixelCount : integer begin using 1cm and 1dm pixel count for correction. end. For example… let's assume pixel pitch is 0.233…mm → not a nice. simple fraction In such panel we will have about 4.285 pixels in 1mm. As integer that is 4pixel in 1mm. This means error will accumulate for "normal" desktop displays… and not so much for mobile phones\tablets. A "normal" desktop display, that is a horiz. side of about 80cm (8dm). Wider than that = too much eye\head horiz. rotation, when optimal min. to medium size of text UI elements are displayed for comfortable reading and optimal maximum usage of screen real estate at the same time (a.k.a «ne zoom» or text\UI upsize needed) In 1cm obviously we will have 42.85 pixels  ≈ 43 but we can not round to upper value. In 1dm obviously there will be 428.5 pixels. This is great because this .5 error is simple fraction... the best one: ½ So 10cm (1dm) we can have 428 pixels and next 10cm → 429 pixels  thus 20cm real size = 428 + 429 pixels This nonsense PPI\DPI should have stopped in mid '90s. ---------------------------------------------------------------------- avra · 2022-11-09 09:12 domasz, your code works nice on my 2nd monitor: QuoteResolution: 1920 x 1080 px Size: 48 x 27 cm Diag: 21,68 inch PPI: 101,60 Dot Pitch: 0,25 mm Aspect Ratio: 1,78:1 Year: 2015 Manufacturer: Hewlett Packard A+B: 476 268 PNP: HWP3185 However, I had to make a quick hack in your code by replacing Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Result := String(Monitor.PNPDeviceID);with Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Result := 'DISPLAY\HPN3431\5&23096ad9&0&UID413955';to get info from my 1st monitor : QuoteResolution: 1920 x 1080 px Size: 53 x 30 cm Diag: 23,98 inch PPI: 91,88 Dot Pitch: 0,28 mm Aspect Ratio: 1,77:1 Year: 2020 Manufacturer: HP Inc. A+B: 527 296 PNP: HPN3431 ---------------------------------------------------------------------- MarkMLl · 2022-11-09 09:43 Quote from: Emptyself on November 09, 2022, 01:05:00 amThis nonsense PPI\DPI should have stopped in mid '90s. I would suggest that you stop flogging that dead horse since if you don't you'll just discourage people from trying to help you elsewhere. MarkMLl ---------------------------------------------------------------------- Emptyself · 2022-11-09 10:51 Quote from: MarkMLl on November 09, 2022, 10:43:13 am I would suggest that you stop flogging that dead horse since if you don't you'll just discourage people from trying to help you elsewhere. MarkMLl I do apologise. But it (that nonsense) has been bothering me for a long time, when the solution is quite\fairly simple. I am still getting nowhere with the book "Oh! Pascal!". I read and understand all the concepts with variables: naming convention, type declaration, etc. I think I have a basic understanding of arrays and such… yet, have no idea about how to use\connect those to what I would like to see happening on the screen and functioning «behind the screen\scene» as code. I see here that competent people have written code examples regarding «pixel density» and such concerns. I can not see myself writing even half of that code in a million years. How, why they write those things, where is the source of explanation for each word used, each row\statement of code? ---------------------------------------------------------------------- Doug22 · 2022-11-09 11:06 domasz, thanks for this code. Very useful to me! How can we modify the code to get info about all monitors currently attached? And also would be useful to know which of these is holds the current app. Thanks again! ---------------------------------------------------------------------- domasz · 2022-11-09 11:08 Quote from: avra on November 09, 2022, 10:12:07 amdomasz, your code works nice on my 2nd monitor: Thanks for testing, much appreciated! Seems I need to loop all the monitors and somehow find the "main" one. Or maybe just return all of them that are "active". ---------------------------------------------------------------------- MarkMLl · 2022-11-09 11:19 Quote from: Emptyself on November 09, 2022, 11:51:12 amI am still getting nowhere with the book "Oh! Pascal!". I read and understand all the concepts with variables: naming convention, type declaration, etc. I think I have a basic understanding of arrays and such… yet, have no idea about how to use\connect those to what I would like to see happening on the screen and functioning «behind the screen\scene» as code. I see here that competent people have written code examples regarding «pixel density» and such concerns. I can not see myself writing even half of that code in a million years. How, why they write those things, where is the source of explanation for each word used, each row\statement of code?  In that case raise that in the other thread you started, and we might be able to thrash something out. Remember that there is likely to be a different group of people monitoring different threads, depending on whether there's been something in the subject line that's caught their eye. MarkMLl ---------------------------------------------------------------------- Doug22 · 2022-11-09 11:26 Quote from: domasz on November 09, 2022, 12:08:10 pmSeems I need to loop all the monitors and somehow find the "main" one. Or maybe just return all of them that are "active". Yes, please! A quick look at the Registry for my computer indicates that Windows stored info for all the monitors that the system has "experienced". For example, I had two monitors attached (laptop screen + regular monitor), but there were at least five relevant monitor entries in the Registry. ---------------------------------------------------------------------- BobDog · 2022-11-09 11:28 It looks like finding an algorithm to get inches or centimetres on your monitor is a bit of a problem. https://www.piliapp.com/actual-size/what-is-my-monitor- size/?next_device=cm-ruler It seems to boil down to actual physical measurement. Other online rulers also require physical input as far as I can tell. So is it worth racking brains. I had a similar problem in another place, in another time, trying to ensure that a ball is always perfectly round in every monitor in gfx graphics (or gdi graphics). I never was successful. ---------------------------------------------------------------------- MarkMLl · 2022-11-09 11:44 Quote from: BobDog on November 09, 2022, 12:28:39 pmIt looks like finding an algorithm to get inches or centimetres on your monitor is a bit of a problem. https://www.piliapp.com/actual-size/what-is-my-monitor- size/?next_device=cm-ruler It seems to boil down to actual physical measurement. Other online rulers also require physical input as far as I can tell. That is a point I've tried to make /repeatedly/. Assuming that the OS hasn't been told the explicit manufacturer and model of display, and that those are sufficiently high-end to be trustworthy, the best that it can get is what DPMI reports. And DPMI comes from the controller card in the monitor, /not/ from the display panel itself, so one can expect somewhere between a few percent error (depending on the panel batch) and the worst kind of marketing fluff. MarkMLl ---------------------------------------------------------------------- J-G · 2022-11-09 12:14 Quote from: MarkMLl on November 09, 2022, 10:43:13 amQuote from: Emptyself on November 09, 2022, 01:05:00 amThis nonsense PPI\DPI should have stopped in mid '90s.I would suggest that you stop flogging that dead horse since if you don't you'll just discourage people from trying to help you elsewhere. MarkMLl I read Emptyself's post about 10 minutes after it had appeared and thought for a little while how best to respond (effectively) but decided that I might lose the will to live if I went down a path that might result in me passing any useful contribution. I have no doubt that the OP has a genuine desire to learn but has little to no idea how the real world IS.  I have no idea why the size of pixels are what they are, it may well be some constraint occasioned due to physics or just economy of items created from materials available. I just have to accept that the pixel size is what it is on the monitor that I have and work with it - not against it. ---------------------------------------------------------------------- VisualLab · 2022-11-09 13:02 QuoteIt looks like finding an algorithm to get inches or centimetres on your monitor is a bit of a problem. https://www.piliapp.com/actual-size/what-is-my-monitor- size/?next_device=cm-ruler It seems to boil down to actual physical measurement. The scale slider is too short (5 inches was missing). Additionally, some monitors have different aspect ratios. The creator of the website probably assumed the aspect ratio of 16:9 in advance. A better solution would be 2 sliders: width and height. ---------------------------------------------------------------------- domasz · 2022-11-09 13:10 Now returns multiple monitors and physical screen size is more accurate. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button1Click(Sender: TObject);var Info: TMonitorInfos;    Len: Integer;    i: Integer;begin  GetMonitorsInfo(Info, Len);   for i:=0 to Len-1 do begin     Memo1.Lines.Add( Format('Resolution: %d x %d px', [Info[i].ResolutionH, Info[i].ResolutionV]) );    Memo1.Lines.Add( Format('Size: %f x %f cm', [Info[i].SizeH, Info[i].SizeV]) );    Memo1.Lines.Add( Format('Diag: %f inch', [Info[i].Diagonal]) );    Memo1.Lines.Add( Format('PPI: %f ', [Info[i].PPI]) );    Memo1.Lines.Add( Format('Dot Pitch: %f mm', [Info[i].DotPitch]) );    Memo1.Lines.Add( Format('Aspect Ratio: %f:1 ', [Info[i].AspectRatio]) );     Memo1.Lines.Add( Format('Year: %d ', [Info[i].ManufactureYear]) );    Memo1.Lines.Add( Format('Manufacturer: %s ', [Info[i].Manufacturer]) );     Memo1.Lines.Add( Format('PNP: %s', [Info[i].PNPID]) );     Memo1.Lines.Add('-----------');  end;end; ---------------------------------------------------------------------- MarkMLl · 2022-11-09 13:14 Quote from: J-G on November 09, 2022, 01:14:47 pmI have no idea why the size of pixels are what they are, it may well be some constraint occasioned due to physics or just economy of items created from materials available. A combination of the amount of memory (and address space) which could be reserved for a bitmap, the bandwidth of the (somewhat inadequate) cable between a PC and a standard monitor, and- later- the mechanical limits on the fineness with which a CRT shadowmask could be made and supported in a piece of mass-market equipment. However the point that he is continuing to attempt to make is that the industry /should/ have followed a trajectory where UI elements etc. were specified in linear dimensions (inches or mm) rather than in pixels. Irrespective of whether I or anybody else agrees with him, it's been explained why that's not the case and I for one have zero patience in attempting to humour him further. MarkMLl ---------------------------------------------------------------------- howardpc · 2022-11-09 13:49 Here's an adapted version of domasz's excellent unit, which removes a memory leak. ---------------------------------------------------------------------- VisualLab · 2022-11-09 13:52 Quote from: J-G on November 09, 2022, 01:14:47 pmQuote from: MarkMLl on November 09, 2022, 10:43:13 amQuote from: Emptyself on November 09, 2022, 01:05:00 amThis nonsense PPI\DPI should have stopped in mid '90s.I would suggest that you stop flogging that dead horse since if you don't you'll just discourage people from trying to help you elsewhere. MarkMLl I read Emptyself's post about 10 minutes after it had appeared and thought for a little while how best to respond (effectively) but decided that I might lose the will to live if I went down a path that might result in me passing any useful contribution. I have no doubt that the OP has a genuine desire to learn but has little to no idea how the real world IS.  I have no idea why the size of pixels are what they are, it may well be some constraint occasioned due to physics or just economy of items created from materials available. I just have to accept that the pixel size is what it is on the monitor that I have and work with it - not against it. For me, this is a rather unusual approach (@Emptyself) to a specific technical issue. I also had no knowledge about it once (DPI, etc.). But it didn't occur to me to "fight with the topic". It is a total waste of time and effort. Really, @Emptyself start by getting a decent book. Years ago (2001-2002) I used the book "Delphi 4 Developer's Guide" by Xavier Pacheco and Steve Teixeira (I still have it). As for today, it is probably already old. But the basics hardly changed (WinAPI, Object Pascal). There are many such books. What I completely disagree with are @Emptyself's ideas with drawing or GUI display in physical units (mm, cm). This is completely pointless. Just think about the effects. Another idea - vector GUI (SVG) instead of bitmap based. FireMonkey (FMX in Delphi and also JavaFX are drawn vector (this is a bit of a simplification as they are quite complicated.) And at the end there is a rasterization stage before displaying. Knowing the physical dimensions is really useful when creating a program that runs on content directed at output devices, eg: printers, plotters, platesetter, CNC machines (e.g. word processors, CAD programs). But these physical sizes are needed in the program workspace. WinAPI has quite a lot of such functions related to mapping (eg MM_HIMETRIC, MM_HIENGLISH) and the coordinate system (eg Get / SetMapMode, SetWindowOrgEx, SetViewPortOrgEx, SetWindowExtEx, SetViewPortExtEx). Probably something similar also exists in Unix systems. In the GUI (ie menus, toolbars, status bars, etc.), this is not needed at all. ---------------------------------------------------------------------- domasz · 2022-11-09 13:59 Quote from: howardpc on November 09, 2022, 02:49:57 pmHere's an adapted version of domasz's excellent unit, which removes a memory leak. I am not sure that many "try"s are needed (surely won't hurt) but indeed I forgot "Monitors.Free". Thanks! ---------------------------------------------------------------------- KodeZwerg · 2022-11-09 14:11 based on last by howardpc, here is my 50cent to this project, correct aspect ratio calculation. (For that the AspectRatio property went from Extended to String type) Hope you like it as I do, by see a realistic value that most of us can easy understand (like 16:9) Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button1Click(Sender: TObject);var Info: TMonitorInfos;    Len: Integer;    i: Integer;begin  GetMonitorsInfo(Info, Len);   for i:=0 to Len-1 do begin     Memo1.Lines.Add( Format('Monitor: #%d', [i]) );    Memo1.Lines.Add( Format('Resolution: %d x %d px', [Info[i].ResolutionH, Info[i].ResolutionV]) );    Memo1.Lines.Add( Format('Size: %f x %f cm', [Info[i].SizeH, Info[i].SizeV]) );    Memo1.Lines.Add( Format('Diag: %f inch', [Info[i].Diagonal]) );    Memo1.Lines.Add( Format('PPI: %f ', [Info[i].PPI]) );    Memo1.Lines.Add( Format('Dot Pitch: %f mm', [Info[i].DotPitch]) );    Memo1.Lines.Add( Format('Aspect Ratio: %s', [Info[i].AspectRatio]) );     Memo1.Lines.Add( Format('Year: %d ', [Info[i].ManufactureYear]) );    Memo1.Lines.Add( Format('Manufacturer: %s ', [Info[i].Manufacturer]) );     Memo1.Lines.Add( Format('PNP: %s', [Info[i].PNPID]) );     Memo1.Lines.Add('-----------');  end;end; ---------------------------------------------------------------------- howardpc · 2022-11-09 14:19 Thanks KodeZwerg, a helpful simplification. ---------------------------------------------------------------------- KodeZwerg · 2022-11-09 14:58 Updated, removed unused things etc and splitted the aspectratio record part up into its original by author invented extended, added for V and H two Int64 and from last post to this added my ready to use string plus fixed a true/false so it work now safe by calling it like: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button1Click(Sender: TObject);var Info: TMonitorInfos;    Len: Integer;    i: Integer;begin  Info := nil;  Memo1.Clear;  if GetMonitorsInfo(Info, Len) then    for i := 0 to Pred(Len) do      begin        Memo1.Lines.Add( Format('Monitor: #%d', [i]) );        Memo1.Lines.Add( Format('Resolution: %d x %d px', [Info[i].ResolutionH, Info[i].ResolutionV]) );        Memo1.Lines.Add( Format('Size: %f x %f cm', [Info[i].SizeH, Info[i].SizeV]) );        Memo1.Lines.Add( Format('Diag: %f inch', [Info[i].Diagonal]) );      Memo1.Lines.Add( Format('PPI: %f ', [Info[i].PPI]) );        Memo1.Lines.Add( Format('Dot Pitch: %f mm', [Info[i].DotPitch]) );      Memo1.Lines.Add( Format('Aspect Ratio: %s', [Info[i].AspectRatioStr]) );        Memo1.Lines.Add( Format('Year: %d ', [Info[i].ManufactureYear]) );        Memo1.Lines.Add( Format('Manufacturer: %s ', [Info[i].Manufacturer]) );        Memo1.Lines.Add( Format('PNP: %s', [Info[i].PNPID]) );        Memo1.Lines.Add('-----------');      end;end; Thank you domasz for inventing and howardpc for fixing ---------------------------------------------------------------------- Emptyself · 2022-11-09 15:06 If I knew it would be that complicated and controversial, I would not have even started the topic. I am a simpleton (in this programming field). Trust me: I do completely understand the discrete nature of pixels vs 'real' space\size, vector rasterization on such pixel screens. But I need a 'real' space\size. Because we all can agree that pixels tend to get smaller and denser. I do not want to think about those pixels: pitch size, per cm, per inch… I want all this to get communicated and done behind the scenes. When I write the code for my """text editor""" and open it on different pixel density monitors, I would like to see a same (fairly same) font height as I want them to appear since I think in mm\in and I (the user) should not be bothered with pixel sizes and density. At least not, but to rather get an optimal minimum font size for comfortable readability + optimal maximum use of screen area from display to display (lets say Full HD ←→ 4K). I really hope I managed to clarify my point. That is why I need such a 'interpreter' function called pretentiously {Fixel} to fix this mess once and for all… bypassing mediocre solutions such as "DPI scaling" and offset UI elements surrounding text\typeface. Yes, I do realise I may seem like a total noob. ---------------------------------------------------------------------- domasz · 2022-11-09 15:31 Quote from: KodeZwerg on November 09, 2022, 03:58:53 pmThanks! Yet another update- I noticed the list of companies is not complete for some reason. So in case full company name is not returned- a short code is returned. Also added a faster full name finder. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button1Click(Sender: TObject);    var Info: TMonitorInfos;      Len: Integer;        i: Integer;    begin      Info := nil;      Memo1.Clear;      if GetMonitorsInfo(Info, Len) then        for i := 0 to Pred(Len) do          begin            Memo1.Lines.Add( Format('Monitor: #%d', [i]) );            Memo1.Lines.Add( Format('Resolution: %d x %d px', [Info[i].ResolutionH, Info[i].ResolutionV]) );            Memo1.Lines.Add( Format('Size: %f x %f cm', [Info[i].SizeH, Info[i].SizeV]) );            Memo1.Lines.Add( Format('Diag: %f inch', [Info[i].Diagonal]) );          Memo1.Lines.Add( Format('PPI: %f ', [Info[i].PPI]) );            Memo1.Lines.Add( Format('Dot Pitch: %f mm', [Info[i].DotPitch]) );          Memo1.Lines.Add( Format('Aspect Ratio: %s', [Info[i].AspectRatioStr]) );            Memo1.Lines.Add( Format('Year: %d ', [Info[i].ManufactureYear]) );            Memo1.Lines.Add( Format('Manufacturer: %s ', [Info[i].Manufacturer]) );            Memo1.Lines.Add( Format('PNP: %s', [Info[i].PNPID]) );            Memo1.Lines.Add('-----------');          end;    end; ---------------------------------------------------------------------- MarkMLl · 2022-11-09 15:34 Quote from: Emptyself on November 09, 2022, 04:06:13 pmThat is why I need such a 'interpreter' function called pretentiously {Fixel} to fix this mess once and for all… bypassing mediocre solutions such as "DPI scaling" and offset UI elements surrounding text\typeface. Well, I hope somebody's prepared to help you. MarkMLl ---------------------------------------------------------------------- KodeZwerg · 2022-11-09 16:05 Quote from: MarkMLl on November 09, 2022, 04:34:21 pmQuote from: Emptyself on November 09, 2022, 04:06:13 pmThat is why I need such a 'interpreter' function called pretentiously {Fixel} to fix this mess once and for all… bypassing mediocre solutions such as "DPI scaling" and offset UI elements surrounding text\typeface. Well, I hope somebody's prepared to help you. MarkMLl More than saying, or trying to say, that what he need he already got in post #3 ( https://forum.lazarus.freepascal.org/index.php/topic,6112 7.msg459008.html#msg459008 ). The Results of that is your full playground when you work with your application in a maximized state. Last try... But what you actual need it just the dimension of the control you are working on so you can interprete that data as your scaling for objects, you as programmer decide how big something is and how much it be in a "size to timeline" calculation instead of your "fixel to whatever" concept way of doing. control dimension = 100% of whatever you think that view should represent as your timeline scala what ends in, yes, dimensions... so x * y in a big x * y, you decide how big the object is by simple working with what is given (a TRect for everything plus one or more smaller inside of that, and as told, you as programmer decide how much size anything is meant to represent on your timeline scala). When you understand that somehow, you have understood the primitiv basics for displays. Working with TRect's simplifies that process a lot BTW, since every dimension must be defined and you are the one that can compute them in a way your logic needs it to have. ---------------------------------------------------------------------- WayneSherman · 2022-11-09 16:36 Quote from: Emptyself on November 09, 2022, 04:06:13 pmIf I knew it would be that complicated and controversial, I would not have even started the topic. It looks like some people are having fun in parts of this topic  .  But (as with all Internet communities), you are sometimes exposed to negative and contentious remarks.  Take the good stuff, ignore the rest. Quote from: Emptyself on November 09, 2022, 04:06:13 pmTrust me: I do completely understand the discrete nature of pixels vs 'real' space\size, vector rasterization on such pixel screens. But I need a 'real' space\size. Because we all can agree that pixels tend to get smaller and denser. I do not want to think about those pixels: pitch size, per cm, per inch… I want all this to get communicated and done behind the scenes. When I write the code for my """text editor""" and open it on different pixel density monitors, I would like to see a same (fairly same) font height as I want them to appear since I think in mm\in and I (the user) should not be bothered with pixel sizes and density. Internally, you can work in whatever units you prefer and you can ignore pixels until you need to render to a physical device (like a monitor or printer) or bitmap image.  For example, CAD and vector editing software can use arbitrary units and display and print things at arbitrary sizes (Inkscape is a vector editing software that lets you work in mm, cm, pixels, inches, picas, and points). Here are some recommendations: 1) When working with graphical elements internally, use vector elements and not bitmaps.  For example, storing a bitmap circle requires an array of pixel values, but a vector circle can be stored as a center coordinate (x,y), radius, color, line width ("pen" or "stroke" size), and fill color.  Vectors can be easily moved and scaled arbitrarily compared to bitmaps.  Imagine the operations involved to move or 2x scale a vector circle in space, compared to moving or scaling a bitmap circle.  For display or output, pixels and bitmaps can then be generated on the fly (rendered) at any size and resolution. 2) Store and work with vectors using floating point numbers and floating point math (Double or Extended). 3) Allow the user to arbitrarily scale and zoom the view (on the screen, and also if you are printing or exporting) ---------------------------------------------------------------------- Emptyself · 2022-11-09 17:54 The vector editors are not a problem, because 90% of the time the user will «zoom» in and out extensively; that is the nature of the so celled 2D and 3D modelling. When we need a 100% zoom ≡ 'real size on the screen', then we have to think\compensate about that "DPI Scaling" I did in MS Windows™ settings, because otherwise my UI elements in the 2D editor look too small on 2K\4K monitor. Of course, some programs offer 'User calibration for 1:1 scale factor', where the user is given a straight bar of pixels to measure with a ruler (mm, cm in my case) on the screen and input the value in mm (in my case of Metric system). Works good and «captures» also the "DPI Scaling". A few weeks ago, when I started some JavaScript tutorial to study programming, I had to make a rectangle using some already "baked" code. I think you call them Libraries. In Pascal maybe 'packages'? So I made it 3×3 pixels to count the real on‑screen pixels under real magnifying glass and thus to check my code. To my surprise it did not look anything like a square, rather a rectangle (landscape aspect)!  I cleaned the magnifying glass again, double checked… same rectangle! I checked the browser "Zoom Page" slider: 100% (nothing scaled) I checkded the code again. width = 3 height = 3 (it works in pixels, maybe with some CSS module the units can be written as XYem, em is a unit for eM-space in typography, but that CSS was too advanced for me) Half an hour took me to triple check and I thought… "OK, this 2K Monitor is 10 years old now, 'burned pixels' is an expected problem at that age.". So a factory reset was performed, I let the monitor to "take a rest" for the weekend. Then hopefully all should be ok. No, it was not! And the only culprit, the great problem turned out to be the 125% "DPI Scaling" in MS Windows™ settings! Now "DPI Scaling" is 100%, my browser is at 130% zoom, but when I check a code I slide it back to 100%. At least the slider is always visible in its status bar, alerting me about 130% zoom. Not so good with other programs UI though. Some have «UI text size\scale» setting but not all. So I had to use Advanced System Font Changer (for Windows OS) Great! It works great really… most of the cases, but now Lazarus and other programs show partly hidden text or menu\drop boxes, whilst others (mainly old programs and help files) get text and UI too tiny! I got so frustrated that in 2022 we have such an ugly discrepancies for something so trivial and important at the same time, such as text… T E X T on screen. This lead to the idea for {Fixel}. ---------------------------------------------------------------------- alpine · 2022-11-09 20:15 Quote from: Emptyself on November 09, 2022, 06:54:59 pmThe vector editors are not a problem, because 90% of the time the user will «zoom» in and out extensively; that is the nature of the so celled 2D and 3D modelling. That is the way of achieving consistency in the "geometrical" sense. WayneSherman has already given proper recommendations to you - everything must be based on a proper mathematical basis. In Windows GUI, things are not built this way and have historically been burdened by being pixel-based. And it won't work without the mentioned 'Custom Calibration for 1:1 Scale Factor' for each individual monitor. That is the way to find the true scaling parameters. The OS reported DPI scaling is nothing but a hint. Quote from: Emptyself on November 09, 2022, 06:54:59 pm*snip* I got so frustrated that in 2022 we have such an ugly discrepancies for something so trivial and important at the same time, such as text… T E X T on screen. This lead to the idea for {Fixel}. It is achievable, at least for a rectangular area of the screen, when you draw the text (and other primitives) by your own, given that you have already measured the specific monitor scaling parameters. Of course, the accuracy will be limited down to a single pixel. The {Fixel} idea is not quite viable for that, better aim for affine transformations - a bit of linear geometry knowledge will be helpful. The BGRA library for example has everything needed to fulfill the requirements - affine transformation, drawing primitives, scaling etc. About the text vs vector drawing - you can always think of a text as of it's bounding rectangle - the rectangle, being "vectorial" figure, is easily transformed between your "virtual" coordinate system and the "viewport" (your window client area). Thus, you can draw the text into a bitmap (virtual canvas), get its bounding rectangle, transform (scale) it to fit exactly the dimensions you needed and then transfer the image from the bitmap to the screen with the same scaling (StretchDraw). But make no mistake that working with proportional fonts is all about that. ---------------------------------------------------------------------- Doug22 · 2022-11-10 11:19 Here's a tiny contribution to the pixel pitch code. To get the PPI of the monitor that holds a particular form, first call GetMonitorInfo (in ver 0.4) as in the above examples, then use: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i MyPPI := Info[MyForm.Monitor.MonitorNum].PPI;Or for code within a form object, use: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i MyPPI := Info[Self.Monitor.MonitorNum].PPI; ---------------------------------------------------------------------- Doug22 · 2022-11-10 12:19 Thanks to domasz, ably assisted by howardpc, and KodeZwerg, the GetMonitorsInfo code has solved a longstanding (>15 years, no exaggeration!) programming dilemma for me. Not for the monitors themselves, however. It turns out that PPI for monitors has an effect in Windows clipboard graphics, because clipboard metafiles use screen parameters as a basis by default. Many of my apps create vector graphics on the clipboard, and I need them to have a definite size. I use one of the size-specific mapping modes (MM_LOMETRIC is my favorite) and draw on a Metafile canvas to create the graphic. The code uses the approximate PPI reported by Windows. This works fine, except for one thing - the graphics, once pasted into another app (e.g., PowerPoint), are almost never the exact size I specified in my code. And the size varies from system to system. Example: I draw a 5" square in the clipboard metafile, then paste into PowerPoint. On one computer, PowerPoint reports its (virtual) size as 5.11 inches; on a second computer, it shows up as 4.93 inches. In fact, the size changes on the same computer if I swap monitors. I have been tearing my hair out about this problem for a very long time. (Not much hair remaining - I started with Turbo Pascal in the 1980's. ) I can't tell you how many hours I have spent scouring the web for ideas and trying various futile fixes. In the end, my apps all took the expedient of including a user-adjustable correction factor to adjust the pasted graphic size, coded as a tFloatSpinEdit. Using the exact PPI returned by GetMonitorsInfo, I can calculate a correction factor that exactly matches the user-adjusted values which give the desired graphic sizes, tested so far on 4 different monitors. Magic! This result also indicated that those devious programmers at Microsoft must have been using the exact monitor PPI behind the scenes in clipboard metafiles. So, thanks to domasz, howardpc, and KodeZwerg, my few remaining hairs are not in jeopardy. Thanks again. ---------------------------------------------------------------------- J-G · 2022-11-10 12:19 Quote from: MarkMLl on November 09, 2022, 02:14:51 pmA combination of the amount of memory (and address space) which could be reserved for a bitmap, the bandwidth of the (somewhat inadequate) cable between a PC and a standard monitor, and- later- the mechanical limits on the fineness with which a CRT shadowmask could be made and supported in a piece of mass-market equipment.I can understand the historic limitations regarding physical manufacture of shadowmasks, I'm more at sea with why the physical size of - I presume LED's  - is what it is. It's really of little consequence and I'm not looking for further clarification -- I accept what we have! Quote from: MarkMLlHowever the point that he is continuing to attempt to make is that the industry /should/ have followed a trajectory where UI elements etc. were specified in linear dimensions (inches or mm) rather than in pixels. Irrespective of whether I or anybody else agrees with him, it's been explained why that's not the case and I for one have zero patience in attempting to humour him further. MarkMLl I'm in the same frame of mind Mark - his latest post tells me that he want's to overturn some 600+ years of printing nomenclature by specifying type size in mm rather than 'points' ---------------------------------------------------------------------- domasz · 2022-11-10 13:09 Quote from: Doug22 on November 10, 2022, 01:19:13 pmSo, thanks to domasz, howardpc, and KodeZwerg, my few remaining hairs are not in jeopardy. Thanks again. I'm glad the code is useful! ---------------------------------------------------------------------- KodeZwerg · 2022-11-10 16:37 Quote from: Doug22 on November 10, 2022, 01:19:13 pmThanks to domasz, ably assisted by howardpc, and KodeZwerg Always welcome  Quote from: Doug22 on November 10, 2022, 01:19:13 pmMany of my apps create vector graphics on the clipboard, and I need them to have a definite size. I use one of the size-specific mapping modes (MM_LOMETRIC is my favorite) and draw on a Metafile canvas to create the graphic. The code uses the approximate PPI reported by Windows. This works fine, except for one thing - the graphics, once pasted into another app (e.g., PowerPoint), are almost never the exact size I specified in my code. And the size varies from system to system. --snip-- I do not understand that clearly but I think you try to think same (wrong) way like OP is doing by discarding the idea that a monitors hardware information and the actual resolution/dpi has somehow not that much together beside that the one is inside the other  So when you have a 100x100 bitmap, it will still be 100x100 on whatever display you run it, the difference is, that the 100x100 will be controlled by the resolution/dpi how its being displayed/scaled in cooperation with the aspect ratio to produce on any display a nearly same looking element (4:3 <-> 16:9, pixel format is ofc different interpreted by display etc... just to name two) So you try to work against the eye-economy of your display and all other display manufactors by discarding the giving and forcing the "your way" ---------------------------------------------------------------------- Emptyself · 2022-11-10 19:48 @domasz I tried to Run\Compile the code of that file in Lazarus 2.2.4 but it give me an error. I know I am a noob and not knowing what am I doing by running the .pas file this way… So, please, tell me what is wrong here? ---------------------------------------------------------------------- KodeZwerg · 2022-11-10 19:56 Quote from: Emptyself on November 10, 2022, 08:48:20 pmI know I am a noob and not knowing what am I doing by running the .pas file this way… Attached full project, hope it helps you a little on your journey ---------------------------------------------------------------------- Emptyself · 2022-11-10 20:57 Quote from: KodeZwerg on November 10, 2022, 08:56:52 pmAttached full project, hope it helps you a little on your journey  Works great! Many thanks. Not really fan of the word "dot", so might change it to "pixel" for the pitch. ---------------------------------------------------------------------- KodeZwerg · 2022-11-10 21:12 Quote from: Emptyself on November 10, 2022, 09:57:22 pmQuote from: KodeZwerg on November 10, 2022, 08:56:52 pmAttached full project, hope it helps you a little on your journey  Works great! Many thanks. Not really fan of the word "dot", so might change it to "pixel" for the pitch. You are welcome, for yourself you can name things however you like but in real life a dot is a dot and a pixel is a pixel, they are not related just that a pixel is made out of dot(s). ---------------------------------------------------------------------- howardpc · 2022-11-11 08:02 Quote from: domasz on November 09, 2022, 04:31:24 pmYet another update- I noticed the list of companies is not complete for some reason. So in case full company name is not returned- a short code is returned. Also added a faster full name finder. Where did the company information come from? Is this via an enumeration of registry data, or from some independent source? ---------------------------------------------------------------------- Emptyself · 2022-11-11 08:44 Quote from: KodeZwerg on November 10, 2022, 10:12:08 pm You are welcome, for yourself you can name things however you like but in real life a dot is a dot and a pixel is a pixel, they are not related just that a pixel is made out of dot(s).  Yes, I am aware of that. Pixel has a picture\image resolution meaning → the square (rect.) building block of single colour, but also a hardware meaning → the smallest, tiniest block of red|green|blue diodes… at least in modern day LCD\OLED monitors. I think «dot» should be only for printing, «pixel» just for digital images and «fixel» for the hardware, because they are fixed and cannot be changed (unless you buy another monitor with dif. density of… fixels), whilst «dot» and «pixel» can be changed respectively from the printer settings and resizing the image digitally. For example: an image of 100×100 pixels might take 320×320 fixels on the screen if intended to be seen on that current screen at 1:1 scale → 1 pixel will get represented by 32² pixels… I mean 32² fixels because that current monitor reports 32f/cm (or ≈3f/mm) then obviously the image will be 3.2×3.2 cm on the screen (no zooming), yet at the same time this same image if printed so its printed size to take up 10×10 cm the printer could be setup for 300dots/cm, thus the whole final printed size image will be of 3000×3000 dots resolution, yet still might look "patched" of squares (the individual pixels of the initial image)… the bigger it gets printed. Fixel could (and should) have saved so much frustration… at least among general users. I am naming it Fixel… it is about time to do so, though should have been done by the late '90s already. ---------------------------------------------------------------------- domasz · 2022-11-11 09:09 Quote from: howardpc on November 11, 2022, 09:02:45 amWhere did the company information come from? Is this via an enumeration of registry data, or from some independent source? https://uefi.org/pnp_id_list Seems these are the guys that register all the 3-letter company names so the list *should* be complete. But I tried on my AOC monitor and AOC was not on the list so I added it to my list. ---------------------------------------------------------------------- Emptyself · 2022-11-11 10:06 There… pure bliss!  Had to modify some calc, but seems it works! Much, much better! ---------------------------------------------------------------------- domasz · 2022-11-11 10:29 Quote from: Emptyself on November 11, 2022, 11:06:51 amJust 2 things to be aware of: 1) Works only under Windows. Won't work on MacOS nor Linux. Should work on anything from Windows XP up. Compiles nicely with Lazarus and Delphi 7. 2) Will return wrong values for monitors with resolutions higher than 4096x4096. This perhaps can be fixed but I don't have access to such a monitor ---------------------------------------------------------------------- alpine · 2022-11-11 12:35 Quote from: domasz on November 11, 2022, 11:29:18 amQuote from: Emptyself on November 11, 2022, 11:06:51 amJust 2 things to be aware of: 1) Works only under Windows. Won't work on MacOS nor Linux. Should work on anything from Windows XP up. Compiles nicely with Lazarus and Delphi 7. 2) Will return wrong values for monitors with resolutions higher than 4096x4096. This perhaps can be fixed but I don't have access to such a monitor On my virtualized Win7 (VirtualBox 6.1) the info returned is all zeros. Not to mention that the display may go through additional scaling. This is true not only for VirtualBox but also for any remote access application - AnyDesk, TeamViewer, etc. On my Win10 notebook (ASUS UX303L) the info is: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Monitor: #0Resolution: 3200 x 1800 fxSize: 29.30 x 16.50 cmDiag: 33.63 cmfx/cm: 109.19 Fixel Pitch: 0.09 mmAspect Ratio: 16:9 (1.78:1)Year: 2014 Manufacturer: SDC PNP: SDC364A-----------It has a resolution (pitch 0.09mm) too big for it's physical dimensions (13.2"), and it is almost unusable with Windows in full resolution. Because of that, I've changed it to 1600x900 (1/4). Now every pixel is a square of 4 pixels. The "Fixel" pitch must be doubled. The point is that the display resolution might have been changed with something other, even the new aspect ratio might be different. My working machine has 2 monitors with equal resolution but different physical dimensions. What if you put your "Fixel" calibrated drawing to be one-half visible on the left monitor and the other half on the right one? ---------------------------------------------------------------------- Emptyself · 2022-11-11 14:04 Quote from: y.ivanov on November 11, 2022, 01:35:31 pmIt has a resolution (pitch 0.09mm) too big for it's physical dimensions (13.2"). My working machine has 2 monitors with equal resolution but different physical dimensions. What if you put your "Fixel" calibrated drawing to be one-half visible on the left monitor and the other half on the right one? I do not know how the code works. It is not my code. FixelPitch of 0.09mm (≈ ⅟₁₀ mm ) is quite tiny… this is in the realm of 4K (for 13" diagonal, 16:9 AR ≈ 1.7778), that is 3197 fixels width, OK technically it is 3K. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Screen size     Resolution      Aspect ratio    Pixel density   Pixel pitch11.6" wide      1920 × 1080 pixels     16:9    Approx. 190 ppi Approx. 0.13 mm13.3" wide      1920 × 1080 pixels     16:9    Approx. 227 ppi Approx. 0.11 mm12" wide        2160 × 1440 pixels     3:2     Approx. 216 ppi Approx. 0.12 mm13.3" wide      2560 × 1440 pixels     16:9    Approx. 221 ppi Approx. 0.12 mm13.3" wide      2560 × 1600 pixels     16:10   Approx. 227 ppi Approx. 0.11 mm14" wide        3200 × 1800 pixels     16:9    Approx. 256 ppi Approx. 0.1 mm15.4" wide      2880 × 1880 pixels     16:10   Approx. 223 ppi Approx. 0.12 mm15.6" UHD 4K    3840 × 2160 pixels     16:9    Approx. 282 ppi Approx. 0.09 mm I really believed that manufacturers of displays would provide the FixelPitch physical dimensions of their display monitors. the same way they provide the resolution, 'size' (diagonal… quite meaningless if you ask me) und  aspect ratio (prop. coefficient). Of course one of the confusion eliminated is to agree on using [mm] units of measurements instead. Not mixing inch and mm. the 'approx.' values should be Fixeled to an exact value for the self–monitor (current). For example if the FixelPitch is 'approx.' 0.23mm then 1920 fixels would = 441.6mm physical width for the screen. Let's say we measure it (width for the screen)  and it is 'approx.' 452mm. Since we can not change the count of Fixels (1920) then we will round the 'approx.' to closer integer values in mm. 452 / 1920 = 0.235mm fixel pitch 0.235*1920 = 451.2 (≈452) ±1mm for such measurement is an acceptable error: "thermal expansion" etc. Ok, let it be 451… 451/1920 = 0.2348mm no big deal no one will get hurt making a correction to the fixel pitch as long as it is at the third decimal place (x * ⅟₁₀₀₀ of mm, where x is a single digit > 0) or as long as it is at the closest integer value for the width of a monitor (resp. the height) in mm. here is an article: Understanding pixel density in the age of 4K