English 中文(简体)
采用习俗字体:拉贝尔数字-7字体
原标题:Using custom fonts : digital-7 fonts for Label
  • 时间:2012-01-13 06:05:43
  •  标签:
  • iphone
  • fonts

任何人都使用国歌中的数字-7字体,即找到案文在底线上调(在Y轴上低线,而不是在标签的垂直中心)。 谁能找到解决办法来显示它们所支持的中心?

最佳回答

你与这一特定字体一样,再次要求的是,它使Y轴心上的低调,而不是放在标签的垂直中心。 一些解决办法:

  1. get a font manager and fix the font by hand
  2. adjust the UILabel instances or a UILabel subclass to push it up higher than it is. You could do this by intercepting a setFrame call, for instance.

As far as I can see, UIFont does not carry that information with it at all. It might, though: you can check some of the read-only properties of the font.

但是,你仍然能够把set<>/strong>的地产 on上,因此你不能以这种方式加以调整。

问题回答

try this..

UILabel *testLabel    = [[UILabel alloc] initWithFrame:CGRectMake(148, 142, 130, 25)];
[testLabel setFont:[UIFont fontWithName:@"DBLCDTempBlack" size:20]];
[testLabel setText:@"MY Text"];
[testLabel setTextColor:[UIColor darkGrayColor]];
[testLabel setBackgroundColor:[UIColor clearColor]];
[testLabel setTextAlignment:UITextAlignmentCenter];

I had used custom fonts in my project earlier. Just you have to add the font.tff file in your project and set your font with setFont method





相关问题
Java (AWT): fitting text in a box

I have an application that extends a Frame. Then, it ll display a few lines of text using: Font f = new Font("Arial", Font.PLAIN, 10); g.setFont(f); g.drawString("Test|great Yes ^.", x, y + 10); Now ...

Embed font into PDF file by using iText

I defined a tag map, and got a XML data file. I want to convert the XML data file to PDF by using iText. The question is how to embed fonts (e.g. Polish font, Chinese font) into the target PDF when ...

Font Rendering between Mozilla and webkit

I m not sure if this has anything to do with the recent Safari update, but I m beginning to notice this a lot. There is a drastic difference in the way each browser is rendering fonts. for instance, ...

Embedding Fonts in AS3 - Dynamic Text Field disappears

This is hopefully a new problem or just me missing something obvious. Please help! I m embedding a font into my AS3 application. I m doing everything by-the-book and it half-works. In my main class, ...

Dynamic GD image width text

I m trying to spice up my website by using custom fonts for headings. For me, the most appropriate way to do this is using PHP and GD. I have written a little script which will output the dynamic text ...

How do I combine @font-face and @media declarations?

I d like to build a common typography stylesheet with a very small number of selectors. As such, I d far prefer to use @media sections for the various versions rather than create different files, each ...