Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

let bullet tag define bullet glyph and separate, indented text style #6

Open
algal opened this issue Feb 15, 2012 · 1 comment
Open

Comments

@algal
Copy link
Contributor

algal commented Feb 15, 2012

Right now, the bullet tag defines one style that applies both to the bullet glyph and to the text associated with the bullet. For instance, font overrides bulletFont and color overrides bulletColor. After the following style, the bullet and the text are green and sixteen point:

FTCoreTextStyle *bulletStyle = [defaultStyle copy];
bulletStyle.name = FTCoreTextTagBullet;
bulletStyle.bulletFont = [UIFont fontWithName:@"TimesNewRomanPSMT" size:32.f];
bulletStyle.bulletColor = [UIColor orangeColor];
bulletStyle.bulletCharacter = @"❧";
bulletStyle.font = [UIFont fontWithName:@"Helvetica" size:16.0f];
bulletStyle.color = [UIColor greenColor];

It would be good if there could be two styles. Then you could use one font and colour for the bullet glyph (e.g., blue, Webdings) and the letter glyphs from another (e.g., black, Helvetica).

In addition, I may be wrong, but I think defining a separate style for the bullet text is necessary just to support the usual indentation of the non-initial lines of text associated with a list item, as it works for in HTML for instance. I'd be very interested in helping with this but I'm not sure where to start.

For instance, I am not sure how to use CoreText to produce this indentation style, or if what I've suggested is the approach that best fits the component's close fit to CoreText's own model

@algal
Copy link
Contributor Author

algal commented Feb 20, 2012

My original comment here referred to two issues:
(1) separate style for the bullet character and for the bullet's text;
(2) bullet text indented according to the usual HTML "list style."

I still believe (1) is in fact a bug, given that the API defines bulletFont and bulletColor, presumably to distinguish it from the text font and text colour of the style, but then in my experiments one overrides the other.

However, as regards (2), I did some digging and realised you can already get this effect using FTCoreText by setting the left value of the paragraphInset to the desired BulletIndent distance. I have to admit I'm quite puzzled why this works.

From experimenting with CoreText directly, I find you can only produce the effect by setting three values (FirstLineHeadIndent=0, TabStop1=BulletIndent, and HeadIndent=BulletIndent) and then beginning the text like "\t". However, from examining the FTCoreText code, and logging the paragraph style with CFShow, I can see that the FTCoreText is only setting two of these values.

I suppose FTCoreText is doing something else, outside of the CTParagraphStyle, that affects layout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant