Repository: fschutt/printpdf (language: rust)

Issue:
"Mismatched Types" Error
I'm trying out some of the examples, however the library does not seem willing to compile.

```
   Compiling printpdf v0.1.6
error[E0308]: mismatched types
   --> C:\Users\***\.cargo\registry\src\github.com-1ecc6299db9ec823\printpdf-0.1.6\src\types\pl
ugins\graphics\two_dimensional\font.rs:119:39
    |
119 |             ("Ascent".into(), Integer(face_metrics.ascender)),
    |                                       ^^^^^^^^^^^^^^^^^^^^^ expected i64, found i32

error[E0308]: mismatched types
   --> C:\Users\***\.cargo\registry\src\github.com-1ecc6299db9ec823\printpdf-0.1.6\src\types\pl
ugins\graphics\two_dimensional\font.rs:120:40
    |
120 |             ("Descent".into(), Integer(face_metrics.descender)),
    |                                        ^^^^^^^^^^^^^^^^^^^^^^ expected i64, found i32

error[E0308]: mismatched types
   --> C:\Users\***\.cargo\registry\src\github.com-1ecc6299db9ec823\printpdf-0.1.6\src\types\pl
ugins\graphics\two_dimensional\font.rs:121:42
    |
121 |             ("CapHeight".into(), Integer(face_metrics.ascender)),
    |                                          ^^^^^^^^^^^^^^^^^^^^^ expected i64, found i32

error[E0308]: mismatched types
   --> C:\Users\***\.cargo\registry\src\github.com-1ecc6299db9ec823\printpdf-0.1.6\src\types\pl
ugins\graphics\two_dimensional\font.rs:258:51
    |
258 |         let font_bbox = vec![ Integer(0), Integer(max_height), Integer(total_width as i64),
 Integer(max_height) ];
    |                                                   ^^^^^^^^^^ expected i64, found i32

error[E0308]: mismatched types
   --> C:\Users\***\.cargo\registry\src\github.com-1ecc6299db9ec823\printpdf-0.1.6\src\types\pl
ugins\graphics\two_dimensional\font.rs:258:101
    |
258 |         let font_bbox = vec![ Integer(0), Integer(max_height), Integer(total_width as i64),
 Integer(max_height) ];
    |
         ^^^^^^^^^^ expected i64, found i32

error: aborting due to 5 previous errors

error: Could not compile `printpdf`.

To learn more, run the command again with --verbose.
```


This can most likely be fixed pretty fast with type coercions.


Discussion / hints:

Fix patch:
diff --git a/src/types/plugins/graphics/two_dimensional/font.rs b/src/types/plugins/graphics/two_dimensional/font.rs
index ba5c158..e16e615 100644
--- a/src/types/plugins/graphics/two_dimensional/font.rs
+++ b/src/types/plugins/graphics/two_dimensional/font.rs
@@ -116,9 +116,9 @@ impl Font {
         let mut font_descriptor_vec: Vec<(std::string::String, Object)> = vec![
             ("Type".into(), Name("FontDescriptor".into())),
             ("FontName".into(), Name(face_name.clone().into_bytes())),
-            ("Ascent".into(), Integer(face_metrics.ascender)),
-            ("Descent".into(), Integer(face_metrics.descender)),
-            ("CapHeight".into(), Integer(face_metrics.ascender)),
+            ("Ascent".into(), Integer(face_metrics.ascender as i64)),
+            ("Descent".into(), Integer(face_metrics.descender as i64)),
+            ("CapHeight".into(), Integer(face_metrics.ascender as i64)),
             ("ItalicAngle".into(), Integer(0)),
             ("Flags".into(), Integer(32)),
             ("StemV".into(), Integer(80)),
@@ -255,7 +255,7 @@ impl Font {
             w, dw,
         ]);
 
-        let font_bbox = vec![ Integer(0), Integer(max_height), Integer(total_width as i64), Integer(max_height) ];
+        let font_bbox = vec![ Integer(0), Integer(max_height as i64), Integer(total_width as i64), Integer(max_height as i64) ];
         font_descriptor_vec.push(("FontFile3".into(), Reference(doc.add_object(font_stream))));
 
         // although the following entry is technically not needed, Adobe Reader needs it


Test patch: