Das Apple iPhone bietet eine begrenzte Anzahl von Schriften für Entwickler. Die Liste der verfügbaren Schriften wird leicht durch Code erreicht, wie wir sehen werden. Wenn Sie Ihre eigenen Schriftarten, wie es auch in den Ressourcen nutzen wollen, ist es ein bisschen komplizierter und conivolge auch die Erteilung von Lizenzen (Gebühren) auf der font "embeddati" ... wir reden später. Gehen wir zurück zu den vorhandenen Schriftarten in Apple iPhone sind offizielle (click image to zoom):
Das Apple iPhone SDK bietet Ihnen Zugriff auf die speziellen System-Fonts. Diese werden durch spezielle Konstanten identifiziert und sind:
1 2 3 | [ UIFont boldSystemFontOfSize : 12.0 ] ; UIFont myBoldFont * = [UIFont boldSystemFontOfSize: 12,0]; [ UIFont SystemFontOfSize : 12.0 ] ; UIFont mySystemFont * = [UIFont SystemFontOfSize: 12,0]; [ UIFont italicSystemFontOfSize : 12.0 ] ; UIFont myItalicFont * = [UIFont italicSystemFontOfSize: 12,0]; |
Falls Sie stattdessen einen Zeiger auf eine Schriftart Odei in das Bild oben einfach gezeigt zu bekommen:
1 | [ UIFont fontWithName : @ "Helvetica-Bold" size : 22.0 ] ; UIFont myCustomFont * = [UIFont fontWithName: @ "Helvetica-Bold" Größe: 22,0]; |
Wie Sie vielleicht bemerkt haben, das Management der Schrift ist recht ungewöhnlich in der Familie (Helvetica, Courier, etc ...), müssen Sie die Art (fett, kursiv, etc ...) angeben. In der Praxis sollte daher eine Schrift mit diesen Eigenschaften zur Verfügung gestellt werden. Die Helvetica beispielsweise vorliegt mit:
1 2 3 4 | Helvetica Helvetica-Bold Helvetica-Oblique Helvetica-BoldOblique |
Wenn Sie Ihre Schrift direkt auf Ihrem iPhone ansehen möchten, sind hier ein paar Zeilen Code nützlich:
1 2 3 4 5 6 7 8 9 10 11 12 | listOfFonts = [ [ NSArray alloc ] initWithArray : [ UIFont familyNames ] ] ; NSArray * listOfFonts = [[ NSArray alloc] initWithArray: [UIFont familynames]]; subFontTypes; NSArray * subFontTypes; int i = 0 ; i< [ listOfFonts count ] ; i ++ ) { for (int i = 0; i <[listOfFonts count]; i + +) { "Font Family: %@" , [ listOfFonts objectAtIndex : i ] ) ; NSLog (@ "Schriftfamilie:% @", [listOfFonts objectAtIndex: i]); NSArray alloc ] initWithArray : [ UIFont fontNamesForFamilyName : [ listOfFonts objectAtIndex : i ] ] ] ; subFontTypes = [[ NSArray alloc] initWithArray: [UIFont fontNamesForFamilyName: [listOfFonts objectAtIndex: i]]]; int j = 0 ; j< [ subFontTypes count ] ; j ++ ) { for (int j = 0; j <[subFontTypes count]; j + +) { "+----->Type: %@" , [ subFontTypes objectAtIndex : j ] ) ; NSLog (@ "+ -----> Typ:% @", [subFontTypes objectAtIndex: j]); } ; [SubFontTypes release]; } ; [ListOfFonts release]; |
Mit dem SDK 2.2.1, auf meinem Simulator, bekam ich:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17. 18 19 20 21. 22. 23. 24 25 26. 27. 28. 29. 30 31. 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | Schriftfamilie: Courier + -----> Typ: Courier + -----> Typ: Courier-BoldOblique + -----> Typ: Courier-Oblique + -----> Typ: Courier-Bold Schriftfamilie: AppleGothic + -----> Typ: AppleGothic Schriftfamilie: Arial + -----> Typ: ArialMT + -----> Typ: Arial-BoldMT + -----> Typ: Arial-BoldItalicMT + -----> Typ: Arial-ItalicMT Schriftfamilie: STHeiti TC + -----> Typ: STHeitiTC-Light + -----> Typ: Medium-STHeitiTC Schriftfamilie: Hiragino Kaku Gothic Pron + -----> Typ: HiraKakuProN-W6 + -----> Typ: HiraKakuProN-W3 Schriftfamilie: Courier New + -----> Typ: CourierNewPS-BoldMT + -----> Typ: CourierNewPS-ItalicMT + -----> Typ: CourierNewPS-BoldItalicMT + -----> Typ: CourierNewPSMT Schriftfamilie: Zapfino + -----> Typ: Zapfino Schriftfamilie: Arial Unicode MS + -----> Typ: ArialUnicodeMS Schriftfamilie: STHeiti SC + -----> Typ: Medium-STHeitiSC + -----> Typ: STHeitiSC-Light Schriftfamilie: American Typewriter + -----> Typ: AmericanTypewriter + -----> Typ: AmericanTypewriter-Bold Schriftfamilie: Helvetica + -----> Typ: Helvetica-Oblique + -----> Typ: Helvetica-BoldOblique + -----> Typ: Helvetica + -----> Typ: Helvetica-Bold Schriftfamilie: Marker Felt + -----> Typ: Thin-MarkerFelt Schriftfamilie: Helvetica Neue + -----> Typ: HelveticaNeue + -----> Typ: HelveticaNeue-Bold Schriftfamilie: DB LCD Temp + -----> Typ: DBLCDTempBlack Schriftfamilie: Verdana + -----> Typ: Verdana Bold- + -----> Typ: Verdana-BoldItalic + -----> Typ: Verdana + -----> Typ: Verdana-Italic Schriftfamilie: Times New Roman + -----> Typ: TimesNewRomanPSMT + -----> Typ: TimesNewRomanPS-BoldMT + -----> Typ: TimesNewRomanPS-BoldItalicMT + -----> Typ: TimesNewRomanPS-ItalicMT Schriftfamilie: Georgien + -----> Typ: Georgia-Bold + -----> Typ: Georgia + -----> Typ: Georgia-BoldItalic + -----> Typ: Georgia-Italic Schriftfamilie: STHeiti J + -----> Typ: Medium-STHeitiJ + -----> Typ: STHeitiJ-Light Schriftfamilie: Arial Rounded MT Bold + -----> Typ: ArialRoundedMTBold Schriftfamilie: Trebuchet MS + -----> Typ: TrebuchetMS-Italic + -----> Typ: TrebuchetMS + -----> Typ: Trebuchet-BoldItalic + -----> Typ: TrebuchetMS-Bold Schriftfamilie: STHeiti K + -----> Typ: Medium-STHeitiK + -----> Typ: STHeitiK-Light |











Es sind keine Kommentare für diesen Beitrag
Hinterlasse einen Kommentar