Shimen the main contribution, respect the work of the author, please do not reprint.
If the article is helpful to you, you are welcome to donate to the author, support the Shimen, donate the amount at random, ^_^
I want to donate: Click Donate
Cocos2d-x source Download: Dot I teleport
Games Official Download:HTTP://DWZ.CN/RWTJL
Game video preview:http://dwz.cn/RzHHd
Game Development Blog:Http://dwz.cn/RzJzI
Game Source Transfer : Http://dwz.cn/Nret1
One, PX and PT conversions
PX: unit of relative length. Pixels (Pixel). (PS font)
PT: Absolute length unit. Point. (iOS fonts)
The formula is as follows:
pt= (px/96) *72.
Two, inter-font conversion
1in = 2.54cm = 25.4 mm = 72PT = 6pc
The specific conversion is:
Points Pixels Ems Percent
6pt 8px 0.5em 50%
7pt 9px 0.55em 55%
7.5pt 10px 0.625em 62.5%
8pt 11px 0.7em 70%
9pt 12px 0.75em 75%
10pt 13px 0.8em 80%
10.5pt 14px 0.875em 87.5%
11pt 15px 0.95em 95%
12pt 16px 1em 100%
13pt 17px 1.05em 105%
13.5pt 18px 1.125em 112.5%
14pt 19px 1.2em 120%
14.5pt 20px 1.25em 125%
15pt 21px 1.3em 130%
16pt 22px 1.4em 140%
17pt 23px 1.45em 145%
18pt 24px 1.5em 150%
20pt 26px 1.6em 160%
22pt 29px 1.8em 180%
24pt 32px 2em 200%
26pt 35px 2.2em 220%
27pt 36px 2.25em 225%
28pt 37px 2.3em 230%
29pt 38px 2.35em 235%
30pt 40px 2.45em 245%
32pt 42px 2.55em 255%
34pt 45px 2.75em 275%
36pt 48px 3em 300%
3. Conversion of pixels to millimeters
The conversion also needs to know another parameter: DPI (how many dots per inch)
Number of pixels/DPI = inches
Number of inches * 25.4 = millimeters
There is a common approach for display devices, whether they are printers or screens
Use GetDeviceCaps first (device handle, LOGPIXELSX)
Or
GetDeviceCaps (device handle, logpixelsy) gets the number of pixels per inch of the device
respectively: px and py
one inch equals 25.4mm
The formula for converting millimeters into pixels is
Horizontal conversion: X * px/25.4
Conversion in vertical direction: Y * py/25.4
Pixel conversion to mm x * 25.4/px
It's written in the program.
Mycontrol.height: = 10{mm} * pixelsperinch * div 254;
Multiply the numerator and denominator by 10, converting floating-point operations to integer operations, which is more efficient
Standard resolutions such as 1024x768 or 800x600 are commonly used to calculate the DPI as a constant: 96, so the calculated millimeter-to-pixel relationship is also approximately equal to a constant:
Basically 1 millimeters equals 3.78 pixels.
Shimen the main contribution, respect the work of the author, please do not reprint.
If the article is helpful to you, you are welcome to donate to the author, support the Shimen, donate the amount at random, ^_^
I want to donate: Click Donate
Cocos2d-x source Download: Dot I teleport
Games Official Download:HTTP://DWZ.CN/RWTJL
Game video preview:http://dwz.cn/RzHHd
Game Development Blog:Http://dwz.cn/RzJzI
Game Source Transfer : Http://dwz.cn/Nret1
[Ios]ios's Font conversion problem