motion-dynamic-type 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +11 -0
- data/README.md +33 -6
- data/Rakefile +8 -3
- data/lib/motion-dynamic-type/font.rb +22 -1
- data/lib/motion-dynamic-type/version.rb +1 -1
- data/motion-dynamic-type.gemspec +6 -6
- data/spec/font_spec.rb +40 -2
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 49b535e0352b4207c1268c6d85e1030258b98dc537906ae005b884c803c0cf56
|
4
|
+
data.tar.gz: 600cbbc45fcf46cdac4adb715d61e39a208b35d635ea7a8606133fb396465266
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d28252b29973c9d071ffdc45437f8c2cf6931ab0a19677d25582e0c49139f71dac6af3682fb3aac8e7102aebfa014313283f30fd18b1471794bee45d9331b9f4
|
7
|
+
data.tar.gz: a57a9e5c6d8dd872929dcbfc011861ebed00db7de4e7b24b1f5d12103dee6f06f8fc468152a9978822ffcffa469bbc7ed1e1e98b6fddb6b6bb62a615440a555c
|
data/.travis.yml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
language: objective-c
|
2
|
+
env:
|
3
|
+
- TMP_DIR=./tmp
|
4
|
+
before_install:
|
5
|
+
- sudo chown -R travis ~/Library/RubyMotion
|
6
|
+
- mkdir -p ~/Library/RubyMotion/build
|
7
|
+
- sudo rm -rf ~/.rubymotion && sudo motion update && sudo motion repo
|
8
|
+
- gem install bundler
|
9
|
+
gemfile:
|
10
|
+
- Gemfile
|
11
|
+
script: bundle exec rake spec
|
data/README.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
|
-
#
|
1
|
+
# MotionDynamicType (MDT)
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/motion-dynamic-type.png)](http://badge.fury.io/rb/motion-dynamic-type) [![Build Status](https://travis-ci.org/wndxlori/motion-dynamic-type.png)](https://travis-ci.org/wndxlori/motion-dynamic-type) [![Code Climate](https://codeclimate.com/github/wndxlori/motion-dynamic-type.png)](https://codeclimate.com/github/wndxlori/motion-dynamic-type)
|
4
|
+
|
5
|
+
|
6
|
+
A simple RubyMotion wrapper for iOS's Dynamic Type to make it easier to set the fonts, as well as getting the information you need and notifications for responding to the layout changes.
|
7
|
+
|
8
|
+
## Help support this gem by learning
|
9
|
+
|
10
|
+
The only reason I can keep making gems and keep them up to date is because lovely people like yourself support me. I create the [Motion in Motion](https://wndx.school/p/motion-in-motion-subscription) subscription series which you can purchase monthly or by the year, I also have an entire school for [Mobile (RubyMotion) development](https://wndx.school). All support, even small amounts really helps.
|
4
11
|
|
5
12
|
## Installation
|
6
13
|
|
@@ -18,12 +25,32 @@ Or install it yourself as:
|
|
18
25
|
|
19
26
|
## Usage
|
20
27
|
|
21
|
-
|
28
|
+
Anything on RubyGems should be stable and fine to use, as this is early days though, the API is prone to change.
|
29
|
+
|
30
|
+
This is the available functionality so far. Eventually this will be a helpful tool for heavily simplifying all the things required for integrating Dynamic Type into your app, including responding to the size changing and working out sizing.
|
31
|
+
|
32
|
+
### MDT::Font
|
33
|
+
|
34
|
+
These methods get a font matching up the the text style. They're just a very simple wrapper around `UIFont.preferredFontForTextStyle`, check out the source code.
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
MDT::Font.large_title
|
38
|
+
MDT::Font.title_one
|
39
|
+
MDT::Font.title_two
|
40
|
+
MDT::Font.title_three
|
41
|
+
MDT::Font.headline
|
42
|
+
MDT::Font.subhead
|
43
|
+
MDT::Font.body
|
44
|
+
MDT::Font.caption_one
|
45
|
+
MDT::Font.caption_two
|
46
|
+
MDT::Font.footnote
|
47
|
+
```
|
22
48
|
|
23
49
|
## Contributing
|
24
50
|
|
25
|
-
1. Fork it ( http://github.com
|
51
|
+
1. Fork it ( http://github.com/wndxlori/motion-dynamic-type/fork )
|
26
52
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
53
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
-
4.
|
29
|
-
5.
|
54
|
+
4. Test your changes (`rake spec`)
|
55
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
56
|
+
6. Create new Pull Request
|
data/Rakefile
CHANGED
@@ -1,8 +1,14 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
$:.unshift("/Library/RubyMotion/lib")
|
3
|
+
$:.unshift("~/.rubymotion/rubymotion-templates")
|
4
|
+
|
2
5
|
require 'motion/project/template/ios'
|
3
6
|
|
4
|
-
|
5
|
-
|
7
|
+
begin
|
8
|
+
require 'bundler'
|
9
|
+
Bundler.require(:development)
|
10
|
+
rescue LoadError
|
11
|
+
end
|
6
12
|
|
7
13
|
require 'motion-dynamic-type'
|
8
14
|
|
@@ -10,6 +16,5 @@ Motion::Project::App.setup do |app|
|
|
10
16
|
app.name = 'MotionDynamicTypeTest'
|
11
17
|
app.version = "0.0.1"
|
12
18
|
app.redgreen_style = :full
|
13
|
-
app.deployment_target = "7.0"
|
14
19
|
app.detect_dependencies = true
|
15
20
|
end
|
@@ -4,7 +4,7 @@ module MotionDynamicType
|
|
4
4
|
def body
|
5
5
|
UIFont.preferredFontForTextStyle(UIFontTextStyleBody)
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
def headline
|
9
9
|
UIFont.preferredFontForTextStyle(UIFontTextStyleHeadline)
|
10
10
|
end
|
@@ -24,6 +24,27 @@ module MotionDynamicType
|
|
24
24
|
def footnote
|
25
25
|
UIFont.preferredFontForTextStyle(UIFontTextStyleFootnote)
|
26
26
|
end
|
27
|
+
|
28
|
+
def callout
|
29
|
+
UIFont.preferredFontForTextStyle(UIFontTextStyleCallout)
|
30
|
+
end
|
31
|
+
|
32
|
+
def large_title
|
33
|
+
UIFont.preferredFontForTextStyle(UIFontTextStyleLargeTitle)
|
34
|
+
end
|
35
|
+
|
36
|
+
def title_one
|
37
|
+
UIFont.preferredFontForTextStyle(UIFontTextStyleTitle1)
|
38
|
+
end
|
39
|
+
|
40
|
+
def title_two
|
41
|
+
UIFont.preferredFontForTextStyle(UIFontTextStyleTitle2)
|
42
|
+
end
|
43
|
+
|
44
|
+
def title_three
|
45
|
+
UIFont.preferredFontForTextStyle(UIFontTextStyleTitle3)
|
46
|
+
end
|
47
|
+
|
27
48
|
end
|
28
49
|
end
|
29
50
|
end
|
data/motion-dynamic-type.gemspec
CHANGED
@@ -6,18 +6,18 @@ require 'motion-dynamic-type/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "motion-dynamic-type"
|
8
8
|
spec.version = MotionDynamicType::VERSION
|
9
|
-
spec.authors = ["Jack Dean Watson-Hamblin"]
|
10
|
-
spec.email = ["
|
11
|
-
spec.summary = %q{Simplifying even further iOS
|
12
|
-
spec.description = %q{A simple RubyMotion wrapper for iOS
|
13
|
-
spec.homepage = "https://github.com/
|
9
|
+
spec.authors = ["Jack Dean Watson-Hamblin", "Lori Olson"]
|
10
|
+
spec.email = ["contact@wndx.com"]
|
11
|
+
spec.summary = %q{Simplifying even further iOS's Dynamic Type}
|
12
|
+
spec.description = %q{A simple RubyMotion wrapper for iOS's Dynamic Type to make it easier to set the fonts, as well as getting the information you need and notifications for responding to the layout changes}
|
13
|
+
spec.homepage = "https://github.com/wndxlori/motion-dynamic-type"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.test_files = spec.files.grep(%r{^(spec)/})
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.add_development_dependency "bundler"
|
20
|
+
spec.add_development_dependency "bundler"
|
21
21
|
spec.add_development_dependency "rake"
|
22
22
|
spec.add_development_dependency("motion-redgreen")
|
23
23
|
end
|
data/spec/font_spec.rb
CHANGED
@@ -21,7 +21,6 @@ describe MotionDynamicType::Font do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "#subhead" do
|
24
|
-
|
25
24
|
it "should have the same font descriptor as the subheadline font descriptor when asked for the subheadline font" do
|
26
25
|
mdt_font_descriptor = MotionDynamicType::Font.subhead.fontDescriptor
|
27
26
|
ui_font_descriptor = UIFontDescriptor.preferredFontDescriptorWithTextStyle(UIFontTextStyleSubheadline)
|
@@ -31,7 +30,6 @@ describe MotionDynamicType::Font do
|
|
31
30
|
end
|
32
31
|
|
33
32
|
describe "#caption_one" do
|
34
|
-
|
35
33
|
it "should have the same font descriptor as the caption one font descriptor when asked for the caption one font" do
|
36
34
|
mdt_font_descriptor = MotionDynamicType::Font.caption_one.fontDescriptor
|
37
35
|
ui_font_descriptor = UIFontDescriptor.preferredFontDescriptorWithTextStyle(UIFontTextStyleCaption1)
|
@@ -59,5 +57,45 @@ describe MotionDynamicType::Font do
|
|
59
57
|
end
|
60
58
|
|
61
59
|
end
|
60
|
+
|
61
|
+
describe '#callout' do
|
62
|
+
it "should have the same font descriptor as the callout font descriptor when asked for the callout font" do
|
63
|
+
mdt_font_descriptor = MotionDynamicType::Font.callout.fontDescriptor
|
64
|
+
ui_font_descriptor = UIFontDescriptor.preferredFontDescriptorWithTextStyle(UIFontTextStyleCallout)
|
65
|
+
mdt_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"].should == ui_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe '#large_title' do
|
70
|
+
it "should have the same font descriptor as the large title font descriptor when asked for the large title font" do
|
71
|
+
mdt_font_descriptor = MotionDynamicType::Font.large_title.fontDescriptor
|
72
|
+
ui_font_descriptor = UIFontDescriptor.preferredFontDescriptorWithTextStyle(UIFontTextStyleLargeTitle)
|
73
|
+
mdt_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"].should == ui_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"]
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe '#title_one' do
|
78
|
+
it "should have the same font descriptor as the title one font descriptor when asked for the title one font" do
|
79
|
+
mdt_font_descriptor = MotionDynamicType::Font.title_one.fontDescriptor
|
80
|
+
ui_font_descriptor = UIFontDescriptor.preferredFontDescriptorWithTextStyle(UIFontTextStyleTitle1)
|
81
|
+
mdt_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"].should == ui_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"]
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe '#title_two' do
|
86
|
+
it "should have the same font descriptor as the title two font descriptor when asked for the title two font" do
|
87
|
+
mdt_font_descriptor = MotionDynamicType::Font.title_two.fontDescriptor
|
88
|
+
ui_font_descriptor = UIFontDescriptor.preferredFontDescriptorWithTextStyle(UIFontTextStyleTitle2)
|
89
|
+
mdt_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"].should == ui_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"]
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe '#title_three' do
|
94
|
+
it "should have the same font descriptor as the title three font descriptor when asked for the title three font" do
|
95
|
+
mdt_font_descriptor = MotionDynamicType::Font.title_three.fontDescriptor
|
96
|
+
ui_font_descriptor = UIFontDescriptor.preferredFontDescriptorWithTextStyle(UIFontTextStyleTitle3)
|
97
|
+
mdt_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"].should == ui_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"]
|
98
|
+
end
|
99
|
+
end
|
62
100
|
|
63
101
|
end
|
metadata
CHANGED
@@ -1,29 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-dynamic-type
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jack Dean Watson-Hamblin
|
8
|
+
- Lori Olson
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2021-03-12 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
|
-
- - "
|
18
|
+
- - ">="
|
18
19
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
+
version: '0'
|
20
21
|
type: :development
|
21
22
|
prerelease: false
|
22
23
|
version_requirements: !ruby/object:Gem::Requirement
|
23
24
|
requirements:
|
24
|
-
- - "
|
25
|
+
- - ">="
|
25
26
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
27
|
+
version: '0'
|
27
28
|
- !ruby/object:Gem::Dependency
|
28
29
|
name: rake
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,16 +53,17 @@ dependencies:
|
|
52
53
|
- - ">="
|
53
54
|
- !ruby/object:Gem::Version
|
54
55
|
version: '0'
|
55
|
-
description: A simple RubyMotion wrapper for iOS
|
56
|
+
description: A simple RubyMotion wrapper for iOS's Dynamic Type to make it easier
|
56
57
|
to set the fonts, as well as getting the information you need and notifications
|
57
58
|
for responding to the layout changes
|
58
59
|
email:
|
59
|
-
-
|
60
|
+
- contact@wndx.com
|
60
61
|
executables: []
|
61
62
|
extensions: []
|
62
63
|
extra_rdoc_files: []
|
63
64
|
files:
|
64
65
|
- ".gitignore"
|
66
|
+
- ".travis.yml"
|
65
67
|
- Gemfile
|
66
68
|
- LICENSE.txt
|
67
69
|
- README.md
|
@@ -73,7 +75,7 @@ files:
|
|
73
75
|
- motion-dynamic-type.gemspec
|
74
76
|
- spec/font_spec.rb
|
75
77
|
- spec/main_spec.rb
|
76
|
-
homepage: https://github.com/
|
78
|
+
homepage: https://github.com/wndxlori/motion-dynamic-type
|
77
79
|
licenses:
|
78
80
|
- MIT
|
79
81
|
metadata: {}
|
@@ -92,11 +94,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
94
|
- !ruby/object:Gem::Version
|
93
95
|
version: '0'
|
94
96
|
requirements: []
|
95
|
-
|
96
|
-
rubygems_version: 2.1.11
|
97
|
+
rubygems_version: 3.1.4
|
97
98
|
signing_key:
|
98
99
|
specification_version: 4
|
99
|
-
summary: Simplifying even further iOS
|
100
|
+
summary: Simplifying even further iOS's Dynamic Type
|
100
101
|
test_files:
|
101
102
|
- spec/font_spec.rb
|
102
103
|
- spec/main_spec.rb
|