iOS coretext框架第二章 CTStringAttributes类介绍

来源:互联网 发布:美工是什么职位类别 编辑:程序博客网 时间:2024/05/17 08:36

coretext框架的CTStringAttributes类定义了设置在CFAttributedString中的所有文字的属性


字符属性名称:(按文档顺序)


1.const CFStringRef kCTFontAttributeName;//字体属性   必须是CTFont对象 2.const CFStringRef kCTForegroundColorFromContextAttributeName;//上下文的字体颜色属性 必须为CFBooleanRef 默认为False 3.const CFStringRef kCTKernAttributeName;//字符间隔属性 必须是CFNumberRef对象4.const CFStringRef kCTLigatureAttributeName;//设置是否使用连字属性,设置为0,表示不使用连字属性。标准的英文连字有FI,FL.默认值为1,既是使用标准连字。也就是当搜索到f时候,会把fl当成一个文字。必须是CFNumberRef 默认为1,可取0,1,25.const CFStringRef kCTForegroundColorAttributeName;//字体颜色属性  必须是CGColor对象,默认为black6.const CFStringRef kCTBackgroundColorAttributeName;//背景色,默认没有背景色7.const CFStringRef kCTParagraphStyleAttributeName;//段落样式属性 必须是CTParagraphStyle对象 默认为NIL。查看CTParagraphStyle.h类,了解更多属性。8.const CFStringRef kCTStrokeWidthAttributeName;//笔画线条宽度 必须是CFNumberRef对象,默为0.0f,标准为3.0f9.const CFStringRef kCTStrokeColorAttributeName;//笔画的颜色属性 必须是CGColorRef 对象,默认为前景色10.const CFStringRef kCTUnderlineStyleAttributeName;//字体下划线样式属性 必须是CFNumberRef对象,默为kCTUnderlineStyleNone。可以通过CTUnderlineStypleModifiers 进行修改下划线风格
CTUnderlineStyle(四种下划线形式)      kCTUnderlineStyleNone           = 0x00,//没有下滑线  kCTUnderlineStyleSingle         = 0x01,//一条下划线  kCTUnderlineStyleThick          = 0x02,//加粗下划线  kCTUnderlineStyleDouble         = 0x09 //两条下划线CTUnderlineStyleModifiers(四种下划线样式)   kCTUnderlinePatternSolid        = 0x0000,//连续实线   kCTUnderlinePatternDot          = 0x0100,//点式虚线,如......   kCTUnderlinePatternDash         = 0x0200,//破折号式虚线,如_ _ _   kCTUnderlinePatternDashDot      = 0x0300,//_ . _ . _ . _ .   kCTUnderlinePatternDashDotDot   = 0x0400 //_ . . _ . .11.const CFStringRef kCTSuperscriptAttributeName;//设置字体的上下标属性 必须是CFNumberRef对象 默认为0,可为-1为下标,1为上标,需要字体支持才行。如排列组合的样式Cn112.const CFStringRef kCTUnderlineColorAttributeName;//字体下划线颜色属性 必须是CGColorRef对象,默认为前景色13.const CFStringRef kCTVerticalFormsAttributeName;//文字的字形方向属性 必须是CFBooleanRef 默认为false,false表示水平方向,true表示竖直方向14.const CFStringRef kCTHorizontalInVerticalFormsAttributeName;//在kCTVerticalFormsAttributeName为true情况下,1到4表示水平方向上的字母或数字的个数。必须是CFNumberRef。15.const CFStringRef kCTGlyphInfoAttributeName;//字体信息属性 必须是CTGlyphInfo对象。查看CTGlyphInfo.h类获取更多信息。16.const CFStringRef kCTCharacterShapeAttributeName; //字体形状属性  必须是CFNumberRef对象,默认为0,非0则对应相应的字符形状定义,如1表示传统字符形状。查看 SFNTLayoutTypes.h类17.const CFStringRef kCTLanguageAttributeName;//特殊的文本语言 必须是包含区域标识符(locale identifier)的CFStringRef对象。默认未设置。18.const CFStringRef kCTRunDelegateAttributeName;//CTRun 委托属性 必须是CTRunDelegate对象。查看CTRunDelegate.h类,获取更多信息。19.const CFStringRef kCTBaselineInfoAttributeName;20.const CFStringRef kCTBaselineReferenceInfoAttributeName;21.const CFStringRef kCTWritingDirectionAttributeName;//书写方向。必须是一个CFNumberRefs的数组。包含两个元素,即在kCTWritingDirectionEmbedding(围绕)和kCTWritingDirectionOverride(覆盖)中二选一,同时在kCTWritingDirectionLeftToRight(从左到右)和kCTWritingDirectionRightToLeft(从右到左)中二选一。22.const CFStringRef kCTRubyAnnotationAttributeName;//查看CTRubyAnnotation.h类,获取更多信息。

                                             
0 0