What are MigraDoc font sizes in pixels? - font-size

What are MigraDoc font sizes (Font.Size property) in pixels? I would like to find an equivalent to css small, medium, large, x-large, xx-large and xxx-large.
EDIT
My question actually was what is the relation between MigraDoc unit of measure for font size (from the selected answer I found out it is point) and pixel. As an addition I said what I need it for.

MigraDoc does not know "pixels". All font sizes are in points.
Neither PDF nor RTF have "pixels".
There are 72 points per inch.
https://en.wikipedia.org/wiki/Point_(typography)

Related

iOS: Xcode font size Vs Adobe XD font size

Units of font size: I'm searching answers for the following, please help me to find it.
1. Which unit does Xcode use for font sizes? I mean, is it Pixels or Points or some other term?
One of the members of my designed team pointed at a label in iOS app that I'm working on and asked what is the font size of that label. What should I say? 12Px or 12Pt or just 12 (Saying a number without unit may lead to confusion)
2. Can we put the same Adobe XD font size for a UILabel in Xcode?
I'm developing iOS application UI from the designs in Abode XD. Which unit does Abode XD use for font sizes? I have tried to put the same font size(80) in Xcode, but it has slight differences, attached a screenshot. Do we need a conversion here?
According to this forum thread Adobe XD uses pixels:
XD currently uses a virtual pixel for most of its measurements (including font size), which should be the same unit of measure as a CSS pixel, or most measurements in iOS. It's roughly equal to 1 physical pixel on a 72 dpi monitor (and, incidentally, a point).
I'm not sure if this calculation is completely correct or not but after using it, the text size looks almost the same to me.
I was reading this discussion forum and found one image related to various measurements of a font. The unit of those fonts was in pt.
Then, I came across this table provided by W3schools
As you can see, px is 1/96th of 1 inch and pt is 1/72th of 1 inch. With this, we can form an equation like this -
Since we are provided pt value by Adobe XD, we can easily calculate the px value.
Maybe this can solve the issue of different font sizes. The one provided by Adobe XD is completely different from the one used in CSS.

Actual display size of IOS fonts doesn't match metrics

I am writing an iPad app which requires letters to be displayed at their exact point size regardless of screen size.
I've implemented the text display using a UILabel object. I have the Autoshrink property set to Fixed Font Size, however the letters on the screen are much smaller than indicated by the font metrics. For instance the capitals of a 251 point font, which should be 3.5 inches tall, are only 2 inches on the screen. At different point sizes the same shrinkage happens.
The fontCapHeight is the same as the font size with the font I am using.
How can I make the displayed size is the same as the font size?
For instance the capitals of a 251 point font, which should be 3.5 inches tall, are only 2 inches on the screen.
You're assuming a point is 1/72", which is not true. That's a desktop publishing point. A point in iOS is a certain number of pixels (based on the scale). The number of pixels in an inch are a factor of the screen's pixel density (PPI). iOS provides no way to query for that that I'm aware of. You have to just have a big table that knows. A fairly nice one for that is GBDeviceInfo, but ultimately it just has a big table of values based on looking up specs or measuring screens.
You need your cap height (pt) to be (ppi/scale)*inches, but you can't set cap height directly. You need to set it via the em box size (the "font size"). Here's an example. It takes a label containing a font of any size and make it's cap height be 3".
let font = label.font!
let ppi = 326.0 // iPhone 6s
let scale = Double(UIScreen.main.scale)
let desiredSize = 3.0 // inches
let emBoxRatio = Double(font.pointSize / font.capHeight)
let fontSize = (ppi / scale) * desiredSize * emBoxRatio
label.font = label.font.withSize(CGFloat(fontSize))
Keep in mind that "make its cap height be 3 inches" is not the same thing as "make any particular letter be 3 inches." It depends on the font and the letter. In many fonts, glyphs with a curved top are a little taller than the cap height, and some ascenders may be a little taller than the cap height. While H, X, and I are often exactly the cap height, sometimes they're a little shorter (sometimes O is the cap height rather than X). Sometimes glyphs are above their baseline. There is nothing that says that a font even has to fit within its em box, and some fonts draw wildly outside (Zapfino, I'm looking at you).
My only point here is that you need to check your actual font carefully. Font metrics are serving suggestions at best. They're meant to make fonts with similar metrics "feel" the same. They're not always absolute measures of things.
I don't understand this:
The fontCapHeight is the same as the font size with the font I am using
If the cap height is the same as the "font size" (em box height), then where are the descenders? It feels like you've run out of em box.
Problem solved. I found the following statement at http://blog.fluidui.com/designing-for-mobile-101-pixels-points-and-resolutions/ : "An iOS point is equivalent to 1/163 of an inch. This size is always the same regardless of the resolution of the phone it is on, and comes from the 163DPI of the original iPhone." I couldn't find it anywhere in the Apple documentation, but I'm sure it is there somewhere!

Photoshop Font Pixel Size to Xcode Interface builder Font Point Size

How do I match the font pixel size given to me by my designer in PhotoShop to the correct font size in Xcode Interface builder.
For example, my designer is using Helvetica Neueu Regular 32px Font in his design.
I've used a few points to pixel translation sites, but it doesn't seem exact.
I have attempted to follow the answer from this question, but to no avail:
https://stackoverflow.com/a/6107836/1014164
You will never have perfect results when visually comparing a Photoshop comp to a real program. In fact, it's not un-common for a text layout to be different between different computers because version and operating system differences (as well as monitor layouts) cause the text to reflow every time it's edited.
Unless things are very much different in other versions of Photoshop, your designer hasn't specified 32px because Photoshop doesn't lay text out in pixels - it works in points/picas. The exact text rendering is also dependent on the document's resolution (which is different between print and screen).
The best you can do is get the text to look roughly proportional to the designer's intent. In modern iOS, most apps will use the user's customized font settings anyway.

UIFont: Font size differs

I am setting a custom font to all subviews (such as UILabels) inside my view by a custom function. However, if I try to correct the font size for specific UILabels only via
[lbl_EXAM_Statistics setFont:[UIFont fontWithName:#"PTSans-Regular" size:13]];
The 13point seems to be a little "too small" from what was given me from the Screendesign.
In the psd file however its 13pt to be exact.
Why does the 13pt font size differ from the 13pt font size in my app?
In the screenshot the above text is from the psd file, the bottom one from the iphone simulator.
If I want to get near the text size from the Screendesign to my app I'd have to use somewhat of 18pt - but I cant waste time playing around how to get the exact pt, thats a huge timewaste with all the font size I have to specify directly. So there must be a better way.
Totally depends on your psd.
Best is to set your metrics in Photoshop in pixels. So you can see the size of your font in pixels.
Then if your PSD is at retina size (640 px width), you just have to devide by 2 the px size of your font and you will have the good result on your app.
In the end, don't use pt but px in your PSD and it will be allright (just have to think that 1point in iOS is 2px on retina screen and 1px on non-retina)
Photoshop's font size and the iPhone's should match assuming the PSD file is set to 72dpi (or 144 for retina images).
You can check this in Photoshop using Image->Image Size... and then set the resolution to 72 pixels/inch (keeping the pixels untouched by unchecking "Resample Image:"). If the image is for retina resolution, use 144 pixels/inch.
This will not change the image in any way but make all pt measurements in Photoshop match the iPhone's coordinate system, retina or not.

Converting between pt and pixels

My netbook has a monitor with 10.1 inch length and 1024*600 solution. I think 1pt is about 1/72inch - is the following computation right?
Since the resolution is 1024*600, the
diagonal has about 1186.83 pixels,
thus 1 inch is about 1186.83/10.1 =
117.51 pixels, and thus 1pt is about 117.51/72 = 1.63 pixels, or 1 pixel is about 0.6127 pt.
Using this relationship, I've inserted an image into a LaTeX document, converting pixels to pt, and take the result as a parameter to includegraphics, but the figure in the resulting document is rather blurred.
Is the computation correct? if
not, how or
where am I wrong?
How can I insert an image into a LaTeX document
with precisely the same dimensions as the
original?
Updated:
I'm using pdflatex to compile the document and the image is a png file, and the reason why I do such a stupid computation is that with no width parameter set, the image shown in the document is larger than the actual size, and I can't work out why.
LaTeX is for creating paper documents. The units it uses refer to distance on the paper output, not on the screen. So if you ask for a distance of 72pts in LaTeX, you'll get 1 inch on your printout, but the distance you get on your screen depends on the zoom-level of your pdf or ps reader, which probably doesn't know how big your screen is.
If you simply want to get the raster grid of your image to fit to the screen grid, I'd say the best thing to do is get a higher-quality graphic if you can.
(PS there's a TeX stack exchange site where you could ask your question too...)
I don't know if it will make any difference, but TeX actually uses 72.27 points to the inch (as it predates PostScript, which set the standard 72 points to the inch).

Resources