Skip to content

Commit 0f3372c

Browse files
authored
Merge pull request #75 from mmalecot/dev
v0.28.0
2 parents 32da8ec + ecf284a commit 0f3372c

File tree

10 files changed

+55
-7
lines changed

10 files changed

+55
-7
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Version 0.28.0 (2025-08-07)
2+
3+
## New formats support
4+
5+
- Enhanced Metafile (EMF)
6+
- Figma Design (FIG)
7+
8+
## Fixes
9+
10+
- Free Lossless Audio Codec (FLAC) media type
11+
- Matroska 3D Video (MK3D) media type
12+
- Matroska Audio (MKA) media type
13+
- Matroska Video (MKV) media type
14+
115
# Version 0.27.0 (2025-05-09)
216

317
## New formats support

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "file-format"
3-
version = "0.27.0"
3+
version = "0.28.0"
44
authors = ["Mickaël Malécot <mickael.malecot@gmail.com>"]
55
edition = "2024"
66
description = "Crate for determining the file format of a given file or stream."

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
![Build](https://img.shields.io/github/actions/workflow/status/mmalecot/file-format/ci.yml?branch=main&style=flat-square&logo=github)
44
[![Crates.io](https://img.shields.io/crates/v/file-format.svg?style=flat-square)](https://crates.io/crates/file-format)
55
[![Docs](https://img.shields.io/docsrs/file-format?style=flat-square&logo=docs.rs)](https://docs.rs/file-format)
6-
![Rust](https://img.shields.io/badge/rust-1.60+-blueviolet.svg?logo=rust&style=flat-square)
6+
![Rust](https://img.shields.io/badge/rust-1.85+-blueviolet.svg?logo=rust&style=flat-square)
77
![License](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg?style=flat-square)
88

99
Crate for determining the file format of a given file or stream.
@@ -51,7 +51,7 @@ Add this to your `Cargo.toml`:
5151

5252
```toml
5353
[dependencies]
54-
file-format = "0.26"
54+
file-format = "0.28"
5555
```
5656

5757
## Crate features
@@ -295,7 +295,9 @@ identification.
295295
- Cineon (CIN)
296296
- Digital Picture Exchange (DPX)
297297
- Encapsulated PostScript (EPS)
298+
- Enhanced Metafile (EMF)
298299
- Experimental Computing Facility (XCF)
300+
- Figma Design (FIG)
299301
- Free Lossless Image Format (FLIF)
300302
- Fujifilm Raw (RAF)
301303
- Graphics Interchange Format (GIF)

fixtures/image/sample.emf

7.18 KB
Binary file not shown.

fixtures/image/sample.fig

24.1 KB
Binary file not shown.

src/formats.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,13 @@ formats! {
684684
extension = "eps"
685685
kind = Image
686686

687+
format = EnhancedMetafile
688+
name = "Enhanced Metafile"
689+
short_name = "EMF"
690+
media_type = "image/emf"
691+
extension = "emf"
692+
kind = Image
693+
687694
format = EnterpriseApplicationArchive
688695
name = "Enterprise Application Archive"
689696
short_name = "EAR"
@@ -775,6 +782,13 @@ formats! {
775782
extension = "flf"
776783
kind = Font
777784

785+
format = FigmaDesign
786+
name = "Figma Design"
787+
short_name = "FIG"
788+
media_type = "image/x-figma"
789+
extension = "fig"
790+
kind = Image
791+
778792
format = Filmbox
779793
name = "Filmbox"
780794
short_name = "FBX"
@@ -848,7 +862,7 @@ formats! {
848862
format = FreeLosslessAudioCodec
849863
name = "Free Lossless Audio Codec"
850864
short_name = "FLAC"
851-
media_type = "audio/x-flac"
865+
media_type = "audio/flac"
852866
extension = "flac"
853867
kind = Audio
854868

@@ -1322,14 +1336,14 @@ formats! {
13221336
format = Matroska3dVideo
13231337
name = "Matroska 3D Video"
13241338
short_name = "MK3D"
1325-
media_type = "video/x-matroska"
1339+
media_type = "video/matroska"
13261340
extension = "mk3d"
13271341
kind = Video
13281342

13291343
format = MatroskaAudio
13301344
name = "Matroska Audio"
13311345
short_name = "MKA"
1332-
media_type = "audio/x-matroska"
1346+
media_type = "audio/matroska"
13331347
extension = "mka"
13341348
kind = Audio
13351349

@@ -1343,7 +1357,7 @@ formats! {
13431357
format = MatroskaVideo
13441358
name = "Matroska Video"
13451359
short_name = "MKV"
1346-
media_type = "video/x-matroska"
1360+
media_type = "video/matroska"
13471361
extension = "mkv"
13481362
kind = Video
13491363

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ identification.
161161
* [Electronic Publication (EPUB)](`FileFormat::ElectronicPublication`)
162162
* [Enterprise Application Archive (EAR)](`FileFormat::EnterpriseApplicationArchive`)
163163
* [FictionBook ZIP (FBZ)](`FileFormat::FictionbookZip`)
164+
* [Figma Design (FIG)](`FileFormat::FigmaDesign`)
164165
* [Flash CS5 Project (FLA)](`FileFormat::FlashCs5Project`)
165166
* [Fusion 360 (F3D)](`FileFormat::Fusion360`)
166167
* [InDesign Markup Language (IDML)](`FileFormat::IndesignMarkupLanguage`)

src/readers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,7 @@ impl crate::FileFormat {
975975
"META-INF/application.xml" => return Ok(Self::EnterpriseApplicationArchive),
976976
"META-INF/mozilla.rsa" => return Ok(Self::Xpinstall),
977977
"WEB-INF/web.xml" => return Ok(Self::WebApplicationArchive),
978+
"canvas.fig" => return Ok(Self::FigmaDesign),
978979
"doc.kml" => return Ok(Self::KeyholeMarkupLanguageZip),
979980
"document.json" => return Ok(Self::Sketch43),
980981
"extension.vsixmanifest" => return Ok(Self::MicrosoftVisualStudioExtension),

src/signatures.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,9 @@ signatures! {
559559
format = EightBitSampledVoice
560560
value = b"FORM", b"8SVX" offset = 8
561561

562+
format = EnhancedMetafile
563+
value = b"\x01\x00\x00\x00", b" EMF" offset = 40
564+
562565
format = ExperimentalComputingFacility
563566
value = b"gimp xcf"
564567

tests/image.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ fn test_encapsulated_postscript() {
8585
assert_eq!(fmt, FileFormat::EncapsulatedPostscript);
8686
}
8787

88+
#[test]
89+
fn test_enhanced_metafile() {
90+
let fmt = FileFormat::from_file("fixtures/image/sample.emf").unwrap();
91+
assert_eq!(fmt, FileFormat::EnhancedMetafile);
92+
}
93+
8894
#[test]
8995
fn test_experimental_computing_facility() {
9096
let fmt = FileFormat::from_file("fixtures/image/sample.xcf").unwrap();
@@ -97,6 +103,13 @@ fn test_farbfeld() {
97103
assert_eq!(fmt, FileFormat::Farbfeld);
98104
}
99105

106+
#[cfg(feature = "reader-zip")]
107+
#[test]
108+
fn test_figma_design() {
109+
let fmt = FileFormat::from_file("fixtures/image/sample.fig").unwrap();
110+
assert_eq!(fmt, FileFormat::FigmaDesign);
111+
}
112+
100113
#[test]
101114
fn test_free_lossless_image_format() {
102115
let fmt = FileFormat::from_file("fixtures/image/sample.flif").unwrap();

0 commit comments

Comments
 (0)