UIFont
Parameters
FontSize
The size (in points) to which the font is scaled. This value must be greater than 0.0.
The actual fontSize parameter is pointSize, which is a pixel.
The font size on windows and mac is consistent.
The English font is equivalent to 1/72 inch, which is about 1/2. 8mm.
12 pt words are printed at about 4.2mm. 12 PX is equivalent to 12 pixels.
Although 4th = (14/72) * 96 = 18.6px is closer to 19px, because 18px is a dot matrix, the system displays the dot matrix size first.
In other words: 4 = 18px
Chinese font size VS English font size (lbs) VS pixel value
The following code is used to set a font for the entire App in iOS development without specifying the font size:
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- [self setFontFamily:@"FagoOfficeSans-Regular" forView:self.view andSubViews:YES];
- }
-
- -(void)setFontFamily:(NSString*)fontFamily forView:(UIView*)view andSubViews:(BOOL)isSubViews
- {
- if ([view isKindOfClass:[UILabel class]])
- {
- UILabel *lbl = (UILabel *)view;
- [lbl setFont:[UIFont fontWithName:fontFamily size:[[lbl font] pointSize]]];
- }
-
- if (isSubViews)
- {
- for (UIView *sview in view.subviews)
- {
- [self setFontFamily:fontFamily forView:sview andSubViews:YES];
- }
- }
- }