2012-05-15 17 views
10

के आकार का पालन करता है, मैं एक आईओएस नौसिखिया हूं। मैं एक UIBezierPath कैसे बना सकता हूं जो वर्णमाला का पालन करता है "बी" कहता है। इसका उद्देश्य इस पथ के साथ छूने का ट्रैक करना है।आईओएस UIBezierPath जो फ़ॉन्ट

अग्रिम धन्यवाद।

+2

क्या आपको इसके लिए समाधान मिला? –

+0

हाय .. क्या आपको कोई समाधान मिला? –

उत्तर

0

क्वार्ट्ज 2 डी में चित्रों के लिए मैं पेंटकोड (http://www.paintcodeapp.com/) नामक एक ओएसएक्स ऐप का उपयोग करता हूं। यह मूल रूप से एक वेक्टर ड्राइंग ऐप है जो आपके द्वारा किए गए चित्र के क्वार्ट्ज कोड उत्पन्न करता है। यह वास्तव में बहुत बढ़िया है। ओपेसिटी नामक एक समान ऐप है लेकिन मैंने इसे आजमाया नहीं है।

ऐसे ऐप्स के साथ आप पृष्ठभूमि पर बी को एक गाइड के रूप में प्राप्त कर सकते हैं और अपने बेजियरपाथ को आकर्षित कर सकते हैं। एक बार हो जाने के बाद, बस जेनरेट कोड कॉपी करें और इसे अपनी प्रोजेक्ट में पेस्ट करें।

उम्मीद है कि यह मदद करता है।

+0

बीटीडब्ल्यू, आप एक डेमो संस्करण डाउनलोड कर सकते हैं। शायद यह आपकी समस्या के लिए पर्याप्त हो सकता है। – Marcal

7

CoreText.framework शब्द के पथ पाने के लिए तरीके प्रदान

देख http://www.codeproject.com/Articles/109729/Low-level-text-rendering

कोड ओले Begemann द्वारा बनाई उदाहरण। क्षमा करें, मैं एनिमेटेडपाथ नामक डेमो के लिए यूआरएल डाउनलोड करना भूल गया।

CGMutablePathRef letters = CGPathCreateMutable(); 

CTFontRef font = CTFontCreateWithName(CFSTR("Helvetica-Bold"), 72.0f, NULL); 
NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys: 
         (id)font, kCTFontAttributeName, 
         nil]; 
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:@"Hello World!" 
                   attributes:attrs]; 
CTLineRef line = CTLineCreateWithAttributedString((CFAttributedStringRef)attrString); 
CFArrayRef runArray = CTLineGetGlyphRuns(line); 

// for each RUN 
for (CFIndex runIndex = 0; runIndex < CFArrayGetCount(runArray); runIndex++) 
{ 
    // Get FONT for this run 
    CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(runArray, runIndex); 
    CTFontRef runFont = CFDictionaryGetValue(CTRunGetAttributes(run), kCTFontAttributeName); 

    // for each GLYPH in run 
    for (CFIndex runGlyphIndex = 0; runGlyphIndex < CTRunGetGlyphCount(run); runGlyphIndex++) 
    { 
     // get Glyph & Glyph-data 
     CFRange thisGlyphRange = CFRangeMake(runGlyphIndex, 1); 
     CGGlyph glyph; 
     CGPoint position; 
     CTRunGetGlyphs(run, thisGlyphRange, &glyph); 
     CTRunGetPositions(run, thisGlyphRange, &position); 

     // Get PATH of outline 
     { 
      CGPathRef letter = CTFontCreatePathForGlyph(runFont, glyph, NULL); 
      CGAffineTransform t = CGAffineTransformMakeTranslation(position.x, position.y); 
      CGPathAddPath(letters, &t, letter); 
      CGPathRelease(letter); 
     } 
    } 
} 
CFRelease(line); 

UIBezierPath *path = [UIBezierPath bezierPath]; 
[path moveToPoint:CGPointZero]; 
[path appendPath:[UIBezierPath bezierPathWithCGPath:letters]]; 

CGPathRelease(letters); 
CFRelease(font); 

"आपको जिस शब्द की आवश्यकता है" के साथ "हैलो वर्ल्ड!" को प्रतिस्थापित करें।

+0

कृपया ध्यान दें कि आपको इस साइट पर, यहां दिए गए उत्तर के उपयोगी बिंदु पोस्ट करना चाहिए, या आपके पोस्ट जोखिमों को हटाया जाना चाहिए ["कोई जवाब नहीं"] (http://meta.stackexchange.com/q/8259)। यदि आप चाहें तो आप अभी भी लिंक शामिल कर सकते हैं, लेकिन केवल 'संदर्भ' के रूप में। लिंक को लिंक के बिना जवाब स्वयं ही खड़ा होना चाहिए। –

+0

आपके अनुस्मारक के लिए धन्यवाद – nova

संबंधित मुद्दे