Skip to content

Make heading styling distinguishable from paragraph#1127

Merged
diegoreymendez merged 3 commits intodevelopfrom
feature/improve-heading
Jan 31, 2019
Merged

Make heading styling distinguishable from paragraph#1127
diegoreymendez merged 3 commits intodevelopfrom
feature/improve-heading

Conversation

@pinarol
Copy link
Copy Markdown
Contributor

@pinarol pinarol commented Jan 30, 2019

Fixes: wordpress-mobile/gutenberg-mobile#351

This PR updates the style of Heading block based on wordpress-mobile/gutenberg-mobile#351 (comment)

WPiOS PR: wordpress-mobile/WordPress-iOS#10912
mobile-gutenberg PR: wordpress-mobile/gutenberg-mobile#525

Changes Made

  1. Heading font sizes are updated
  2. Headings made bold by default
  3. ShadowBoldFormatter is added to mimic bolding on already bold headings, it uses shadow attribute to mimic the extra boldness.

The Problem
We want to use bold font with Heading blocks by default. However, we don't want to generate bold output in the html unless user intentionally selects B option from toolbar. That makes it a bit challenging for us to decide how to make this happen. This PR proposes a solution that mimics bolding behavior by giving extra shadow and letter spacing.

To Test

  1. Example app

1.1. Test Heading

  • Verify that the font looks bolder than it was before
  • Select part of the text and tap B button
  • Verify that the selected area gets bolder
  • Switch between H2 H3 H4 types of heading sizes
  • Verify that the boldness of selected area is kept

1.2 Test paragraph

Test that paragraph is not effected:

  • Paragraphs should continue to appear non-bold by default
  • Select part of the text and tap B button
  • Verify that the selected area gets bolder
  1. Test with Gutenberg and Classic editor by Test Steps in WPiOS PR
    Post Editor - Make heading style distinguishable from paragraph WordPress-iOS#10912

1. Heading font sizes are updated
2. Headings made bold by default
3. ShadowBoldFormatter is added to allow Bolding effect on headings by making use of shadow effect
@pinarol
Copy link
Copy Markdown
Contributor Author

pinarol commented Jan 30, 2019

hey @diegoreymendez 👋 @iamthomasbishop will review the new style on the device and will provide some style feedbacks but I think technical side of the PR is ready to review.

// Creates a no blur NSShadow instance with given offset values
static func shadow(width: CGFloat = DefaultOffset.width,
height: CGFloat = DefaultOffset.height,
color: UIColor = UIColor.black) -> NSShadow {
Copy link
Copy Markdown
Contributor Author

@pinarol pinarol Jan 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diegoreymendez 👋 The color choice is sth I want to ask, I couldn't find where to look for to see the what determines the color of headings. So I am thinking choosing black can be problematic in the future, shadow should actually be same as the font color, but not sure how to do it ? any help is appreciated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd stick to the font color... and I'd probably avoid a default (in the method definition) if we can.

Considering both calls to this method have access to the string attributes, I'd pick up the color from there (and default there to black if the color is missing).

private extension Header {
struct Constants {
static let defaultFontSize = Float(14)
static let defaultFontSize = Float(16)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the old value of default font size corresponded to h5 so I updated this as h5's new value also

@pinarol
Copy link
Copy Markdown
Contributor Author

pinarol commented Jan 31, 2019

hey @diegoreymendez 👋 I have updated the color issue.

Copy link
Copy Markdown
Contributor

@diegoreymendez diegoreymendez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @pinarol !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants