Commit Graph

15 Commits

Author SHA1 Message Date
Héctor Ramos 1151c096da Update copyright headers to yearless format
Summary: This change drops the year from the copyright headers and the LICENSE file.

Reviewed By: yungsters

Differential Revision: D9727774

fbshipit-source-id: df4fc1e4390733fe774b1a160dd41b4a3d83302a
2018-09-11 15:33:07 -07:00
Kevin Gozali f50df4f5ec iOS OSS: deployment target 8.0 => 9.0
Summary: Moving target deployment to iOS 9.0+ from now on, removing customization for iOS 8.

Reviewed By: shergin

Differential Revision: D8053439

fbshipit-source-id: 292c58f15c6e6caf8b28d15c1521812d6ed675c5
2018-05-22 01:16:45 -07:00
Kevin Gozali 6611fefef7 iOS: Exposes the RCTFont size overrides so unit tests can use the same values
Summary:
`RCTFontTests` test in RNTester is broken if the target deployment is <= OS 8.2. This is because RCTFont.mm overrides the OS-defined values, but the override is only visible to RCTFont.mm internals. As the result, when the Unit test tries to create UIFont of the "same" weight, it got a different font - most likely due to internal floating rounding errors.

To mitigate, code that wants to test out internals of RCTFont should import RCTFontConstantsOverride.h

Reviewed By: mmmulani

Differential Revision: D7900954

fbshipit-source-id: e5814ef059a8afdfb5205ca1af46c41b3cfd4318
2018-05-07 17:31:12 -07:00
Sophie Alpert 1490ab12ef Update license headers for MIT license
Summary:
Includes React Native and its dependencies Fresco, Metro, and Yoga. Excludes samples/examples/docs.

find: ^(?:( *)|( *(?:[\*~#]|::))( )? *)?Copyright (?:\(c\) )?(\d{4})\b.+Facebook[\s\S]+?BSD[\s\S]+?(?:this source tree|the same directory)\.$
replace: $1$2$3Copyright (c) $4-present, Facebook, Inc.\n$2\n$1$2$3This source code is licensed under the MIT license found in the\n$1$2$3LICENSE file in the root directory of this source tree.

Reviewed By: TheSavior, yungsters

Differential Revision: D7007050

fbshipit-source-id: 37dd6bf0ffec0923bfc99c260bb330683f35553e
2018-02-16 18:31:53 -08:00
Mehdi Mulani f96dfb9468 Disable font scaling when an explicit font handler is set
Reviewed By: sahrens

Differential Revision: D7003464

fbshipit-source-id: f36ff344c50a9c63af6c852138041c1c918259c8
2018-02-16 12:37:51 -08:00
Mehdi Mulani a9c684a0ff Allow substituting a default font handler
Reviewed By: nscoding

Differential Revision: D6798995

fbshipit-source-id: 541b4391428d1ee9c0b394033182dc232536c864
2018-01-30 13:51:19 -08:00
Sam Mueller d38b95f8b7 (iOS) Support for ExtraBold alias of Heavy (font-weight 800)
Summary:
ExtraBold is a fairly common suffix in font naming. A good example is "Circe-ExtraBold". It's usually synonymous with Heavy or Black at font weight 800, as described here: https://www.webtype.com/info/articles/fonts-weights/

This fixes a regression with ExtraBold fonts introduced in d3007b0 where simply having an extrabold font will cause `weightOfFont` to choose this weight aggressively, resulting in all bold text erroneously interpreted as extrabold/heavy. This fix ensures that extrabold is detected before bold, and correctly attributed to `UIFontWeightHeavy`.
Closes https://github.com/facebook/react-native/pull/16323

Differential Revision: D6119059

Pulled By: shergin

fbshipit-source-id: 56a5c30584f220974308a7d6068c8d952aa20fb8
2017-10-23 11:24:18 -07:00
Sean Holbert 73c3aa8d32 (iOS) Support for DemiBold alias of SemiBold (font-weight 600)
Summary:
For more information on font weight naming see [this post](https://www.quora.com/What-is-the-difference-between-Medium-Demi-and-Semibold-fonts).

DemiBold is fairly common in font naming. For example, iOS React Native lacks support of "AvNext-DemiBold".

Also removed warning about `NSUInteger` <=> `NSInteger` comparison, by making `i` an `NSUInteger`

Before and after screenshots:

![before-fix](https://user-images.githubusercontent.com/177857/30182567-1dfebcb0-93cc-11e7-9b51-78ef6f41c447.png)

![after-fix](https://user-images.githubusercontent.com/177857/30182570-1f90ea94-93cc-11e7-8f68-008ae648ffbe.png)

Add any DemiBold font to an iOS react native project.  Set fontWeight to `'600'` on a `<Text />` component. The font weight should be applied appropriately.
Closes https://github.com/facebook/react-native/pull/15856

Differential Revision: D5800928

Pulled By: shergin

fbshipit-source-id: 9095e3e150847f9cb828aa5d080567846441e55d
2017-09-08 23:01:41 -07:00
Neo d3007b0fd2 fix fontWeight regression
Summary:
fix the regression I mentioned in https://github.com/facebook/react-native/pull/15162#issuecomment-319696706

as no one is working on this, I take the step, although I know nothing about Objective C

I find the key point is that the keys in `NSDictionary` are not ordered as presented, it's a hash table, so no grantee on keys order, so I create a new array to do that, then it will check `ultralight` before `light` and `semibold` before `bold`
Closes https://github.com/facebook/react-native/pull/15825

Differential Revision: D5782142

Pulled By: shergin

fbshipit-source-id: 5346b0cb263e535c0b445e7a2912c452573248a5
2017-09-06 23:51:57 -07:00
Kip Ricker cfeaefb4e0 iOS: Fix font weight resolution
Summary:
**Issue:**
Some fonts are defined with weights that don't match with the UIFontWeight constants.

**Example:**
UIFontWeightTraits for Roboto font
Light: -0.230
Thin: -0.365

Currently, the UIFontWeightTrait is always used if it != 0.0, and given the UIFontWeight constants for Light and Thin:
UIFontWeightThin -0.6
UIFontWeightLight -0.4

A style font weight of "300" or "200" will both resolve to Roboto-Thin as its weight -0.365 is closer to -0.4 (UIFontWeightLight) and -0.6 (UIFontWeightThin) than -0.230 (Roboto-Light).

**Proposed fix:**
When resolving `getWeightOfFont` try to match the name of weight to the name of the font first, and guess the font with UIFontWeightTrait as the fall back.

**Test Plan:**
Attempt to display Roboto at weights "200" and "300" and Roboto-Thin and Roboto-Light should be displayed correctly.

Current:
![simulator screen shot jul 7 2017 11 44 42 am](https://user-images.githubusercontent.com/889895/28506859-31b274e8-6fe3-11e7-8f92-f41ff2183356.png)

Fixed:
![simulator screen shot jul 7 2017 11 42 25 am](https://user-images.githubusercontent.com/889895/28506861-365ea3f4-6fe3-11e7-992c-9f426785037f.png)
Closes https://github.com/facebook/react-native/pull/15162

Differential Revision: D5479817

Pulled By: javache

fbshipit-source-id: a9f93d8ce69a96fb685cb09393d1db42486cc0c2
2017-07-24 08:33:04 -07:00
Roger Chapman c1458e0181 If no match return at least the first font in the family.
Summary:
Solves issue #7632 where fonts with only a single font weight/type would not render.

Example of a built-in font that would not render is `Zapfino` and other custom fonts like `Impact` would not render.
Closes https://github.com/facebook/react-native/pull/10572

Differential Revision: D4143335

Pulled By: hramos

fbshipit-source-id: 2f64aad2fb5ddc7aae2ca7a5362a89b45e550e13
2016-11-07 17:14:02 -08:00
Jacob Parker f951da912d Add iOS support for CSS property font-variant, accepting tabular-nums…
Summary:
Ground work for allowing `font-variant`s. Currently allows switching between `tabular-nums` and `proportional-nums`. I will need guidance on how to test this, and a few pointers on code style (new to Objective C, and had to make one or two hacks).
Closes https://github.com/facebook/react-native/pull/9045

Reviewed By: majak

Differential Revision: D3664338

Pulled By: javache

fbshipit-source-id: 032f326c37ee6150348da2b33b6a3fc1988e8920
2016-08-09 08:43:34 -07:00
Pieter De Baets 6b9406ed5a Fix missing font constants on iOS7
Reviewed By: dinhviethoa

Differential Revision: D3682528

fbshipit-source-id: 7e3a0b7c2c043a869f2f5dfe9aaf404897076d0b
2016-08-07 11:58:30 -07:00
Pieter De Baets f571f016d9 Improve types in RCTFont API
Reviewed By: majak

Differential Revision: D3662880

fbshipit-source-id: f54e1ac164373337460047eb3708a588f578b5fc
2016-08-05 12:44:21 -07:00
Pieter De Baets 3d6240f9a6 Implement system font caching in RCTFont
Reviewed By: majak

Differential Revision: D3662848

fbshipit-source-id: 7135c0a80c6781669e43ae9a58a26a2c85f2c827
2016-08-05 12:44:21 -07:00