@@ -1402,21 +1402,14 @@ impl<'a> Face<'a> {
1402
1402
/// Returns `false` when OS/2 table is not present.
1403
1403
#[ inline]
1404
1404
pub fn is_regular ( & self ) -> bool {
1405
- self . tables
1406
- . os2
1407
- . map ( |s| s. style ( ) == Style :: Normal )
1408
- . unwrap_or ( false )
1405
+ self . style ( ) == Style :: Normal
1409
1406
}
1410
1407
1411
1408
/// Checks that face is marked as *Italic*.
1412
- ///
1413
- /// Returns `false` when OS/2 table is not present.
1414
1409
#[ inline]
1415
1410
pub fn is_italic ( & self ) -> bool {
1416
- self . tables
1417
- . os2
1418
- . map ( |s| s. style ( ) == Style :: Italic )
1419
- . unwrap_or ( false )
1411
+ // A face can have a Normal style and a non-zero italic angle, which also makes it italic.
1412
+ self . style ( ) == Style :: Italic || self . italic_angle ( ) != 0.0
1420
1413
}
1421
1414
1422
1415
/// Checks that face is marked as *Bold*.
@@ -1432,10 +1425,7 @@ impl<'a> Face<'a> {
1432
1425
/// Returns `false` when OS/2 table is not present or when its version is < 4.
1433
1426
#[ inline]
1434
1427
pub fn is_oblique ( & self ) -> bool {
1435
- self . tables
1436
- . os2
1437
- . map ( |s| s. style ( ) == Style :: Oblique )
1438
- . unwrap_or ( false )
1428
+ self . style ( ) == Style :: Oblique
1439
1429
}
1440
1430
1441
1431
/// Returns face style.
@@ -1490,10 +1480,13 @@ impl<'a> Face<'a> {
1490
1480
1491
1481
/// Returns face's italic angle.
1492
1482
///
1493
- /// Returns `None ` when `post` table is not present.
1483
+ /// Returns `0.0 ` when `post` table is not present.
1494
1484
#[ inline]
1495
- pub fn italic_angle ( & self ) -> Option < f32 > {
1496
- self . tables . post . map ( |table| table. italic_angle )
1485
+ pub fn italic_angle ( & self ) -> f32 {
1486
+ self . tables
1487
+ . post
1488
+ . map ( |table| table. italic_angle )
1489
+ . unwrap_or ( 0.0 )
1497
1490
}
1498
1491
1499
1492
// Read https://github.com/freetype/freetype/blob/49270c17011491227ec7bd3fb73ede4f674aa065/src/sfnt/sfobjs.c#L1279
0 commit comments