Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6810153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:10:19+00:00 2026-05-26T20:10:19+00:00

I am using CoreText on the iPhone to get italic text in a UIScrollView.

  • 0

I am using CoreText on the iPhone to get italic text in a UIScrollView. CoreText on the iPhone doesn’t support images. So I tell CoreText to provide some space for an image and then use CGContextDrawImage to draw an image, blendedImage, in a rectangle of 300 by 120 which is a 2.5 ratio. The image that is created, which is blendedImage in the code below, has the same size ration, since 175/70 = 2.5. Since the image, blendedImage, I am creating has text that I want to word wrap as well, I create the image using renderInContext for the UILabels that are in the image. The problem is that the text in the UILabels is blurred and pixelated. Does anyone know how I can fix this?

Here is the code:

CGRect dccFrame                      = CGRectIntegral(CGRectMake(0, 60, 70, 72));  // 20, 60, 100, 72
UILabel *dccLabel                    = [[UILabel alloc] initWithFrame:CGRectIntegral(dccFrame)];
dccLabel.backgroundColor             = [UIColor clearColor];
dccLabel.numberOfLines               = 0;
dccLabel.lineBreakMode               = UILineBreakModeWordWrap;
NSString *titledccString             = self.dccString;
dccLabel.textColor                   = [UIColor blackColor];
dccLabel.font                        = [UIFont fontWithName:@"Arial-BoldMT" size:7];
[dccLabel setText:titledccString];
[dccLabel sizeToFit];

CGSize newSize  = CGSizeMake(176, 70);  

UIGraphicsBeginImageContextWithOptions(newSize, NO, [UIScreen mainScreen].scale);
CGContextRef gc = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(gc, 1, 1, 1, 1);
CGContextSetShouldSmoothFonts(gc, YES);
CGContextSetAllowsAntialiasing(gc, YES);
CGContextSetShouldAntialias(gc, YES);
UIGraphicsPushContext(gc);

CGAffineTransform trf1       = CGAffineTransformMakeTranslation(0, 0);      
CGContextSaveGState(gc);
CGContextConcatCTM(gc, trf1);               
[[UIImage imageNamed: imageString] drawInRect:CGRectIntegral(CGRectMake(70, 0, 46, 60))];  
CGContextRestoreGState(gc);
UIGraphicsPopContext();

CGAffineTransform trf3 = CGAffineTransformMakeTranslation(0, 30);       
CGContextSaveGState(gc);
CGContextConcatCTM(gc, trf3);
[dccLabel.layer renderInContext:gc];
CGContextRestoreGState(gc);

UIImage *blendedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

[dccLabel release];

I have read that if the positions are not integer that can cause pixelation. But I don’t think that is the problem here. I’ve also run Instruments in Core Animation mode and enabled “Color Misaligned Images” but the image I created doesn’t show up as colored, although other images do.

Does anyone know why the text in the UILabel dccLabel is blurred and pixelated and how I can fix it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:10:19+00:00Added an answer on May 26, 2026 at 8:10 pm

    Figured it out, took me awhile ! And the answer is quite simple. Just had to make newSize the same size as the rectangle the image was being drawn into.

     CGSize newSize  = CGSizeMake(300, 120); 
    

    Kind of makes sense to make the image size the same size as the rectangle that the image is being drawn into, right?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Core Text to draw some text. I would like to get
Im using CoreText to display some text, creating framesetter, frames and so, and everything
Let's say I'm writing text viewer for the iPhone using Core Text. Every time
I'm working on a library that does some rich text abstraction using Core Text
I am using CoreText to render multiple columns of text. However, when I set
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using the Cocoa Framework, how can I add bullets and numbering to text?
I'm completely in the dark with Core Text's line spacing. I'm using NSAttributedString and
I am seeing some performance issues with Core Text when it is run on
Using monotouch, I'm try to display a core text element over multiple lines. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.