/** * @since Available in iOS 6.0 and later. */ public NSAttributedStringAttributes getTypingAttributes() { NSDictionary<NSString, ?> dict = getTypingAttributesDictionary(); if (dict == null) return null; return new NSAttributedStringAttributes(dict); } /**
/** * @since Available in iOS 7.0 and later. */ public NSAttributedStringDocumentAttributes setDefaultAttributes(NSAttributedStringAttributes defaultAttributes) { set(NSAttributedStringDocumentAttribute.DefaultAttributes, defaultAttributes.getDictionary()); return this; } /**
private static NSAttributedStringAttributes createAttribs(RoboFont font) { NSAttributedStringAttributes attribs = new NSAttributedStringAttributes(); attribs.setFont(font.ctFont.as(UIFont.class)); // attribs.setForegroundColorFromContext(true); // TODO return attribs; }
/** * @since Available in iOS 6.0 and later. */ public NSAttributedStringAttributes setShadow(NSShadow shadow) { set(NSAttributedStringAttribute.Shadow, shadow); return this; } /**
private static void addStroke(NSAttributedStringAttributes attribs, RoboFont font, float strokeWidth, int strokeColor) { // stroke width is expressed as a percentage of the font size in iOS float strokePct = 100 * strokeWidth / font.size(); attribs.setStrokeWidth(strokePct); // unfortunately we have to set the stroke color here, we cannot inherit it from the context attribs.setStrokeColor(toUIColor(strokeColor)); }
public NSObject get(NSAttributedStringAttribute key) { if (has(key)) { return data.get(key.value()); } return null; } public NSAttributedStringAttributes set(NSAttributedStringAttribute key, NSObject value) {
void fill(CGBitmapContext bctx, float x, float y, int fillColor) { if (this.fillColor != fillColor){ this.fillColor = fillColor; NSAttributedStringAttributes attribs = createAttribs(font); attribs.setForegroundColor(toUIColor(fillColor)); fillLine = CTLine.create(new NSAttributedString(text, attribs)); } paint(bctx, fillLine, x, y); }
private static NSAttributedStringAttributes createAttribs(CTFont font) { NSAttributedStringAttributes attribs = new NSAttributedStringAttributes(); attribs.setFont(font.as(UIFont.class)); // attribs.setForegroundColorFromContext(true); // TODO return attribs; }
/** * @since Available in iOS 7.0 and later. */ public NSAttributedStringAttributes setAttachment(NSTextAttachment attachment) { set(NSAttributedStringAttribute.Attachment, attachment); return this; } /**
private static void addStroke(NSAttributedStringAttributes attribs, CTFont font, float strokeWidth, int strokeColor) { // stroke width is expressed as a percentage of the font size in iOS double strokePct = 100 * strokeWidth / font.getSize(); attribs.setStrokeWidth(strokePct); // unfortunately we have to set the stroke color here, we cannot inherit it from the context attribs.setStrokeColor(toUIColor(strokeColor)); }
public NSObject get(String key) { if (has(key)) { return data.get(new NSString(key)); } return null; } public NSAttributedStringAttributes set(String key, NSObject value) {
void fill(CGBitmapContext bctx, float x, float y, int fillColor) { if (this.fillColor != fillColor){ this.fillColor = fillColor; NSAttributedStringAttributes attribs = createAttribs(font); attribs.setForegroundColor(toUIColor(fillColor)); fillLine = CTLine.create(new NSAttributedString(text, attribs)); } paint(bctx, fillLine, x, y); }
/** * @since Available in iOS 5.0 and later. */ public NSAttributedStringAttributes getScopeBarButtonTitleTextAttributes(UIControlState state) { NSDictionary<NSString, ?> dict = getScopeBarButtonTitleTextAttributesDictionary(state); if (dict == null) return null; return new NSAttributedStringAttributes(dict); } /**
? NSString.getSize(titleText, new NSAttributedStringAttributes().setFont(title.getFont())) : new CGSize(); titleLabelSize.setWidth(Math.min(titleLabelSize.getWidth(), maxWidth)); CGSize messageLabelSize = messageText.length() > 0 ? NSString.getBoundingRect(messageText, maxSize, NSStringDrawingOptions.UsesLineFragmentOrigin, new NSAttributedStringAttributes().setFont(message.getFont()), null).getSize() : new CGSize();
public void addAttributes(NSAttributedStringAttributes attrs, @ByVal NSRange range) { if (attrs == null) { throw new NullPointerException("attrs"); } addAttributes(attrs.getDictionary(), range); } public void addAttributes(CMTextMarkupAttributes attrs, @ByVal NSRange range) {
/** * @since Available in iOS 7.0 and later. */ public NSAttributedStringAttributes setStrikethroughColor(UIColor strikethroughColor) { set(NSAttributedStringAttribute.StrikethroughColor, strikethroughColor); return this; } /**
/** * @since Available in iOS 7.0 and later. */ public NSAttributedStringAttributes getDefaultTextAttributes() { NSDictionary<NSString, ?> dict = getDefaultTextAttributesDictionary(); if (dict == null) return null; return new NSAttributedStringAttributes(dict); } /**