3

I have two different files that have same file extensions: *.otf. But if I right click on these two files, Nautilus shows different "Type:" for them in file properties window: One is ODF template (application/vnd.oasis.opendocument.formula-template) and other is OpenType font (application/x-font-otf)! But I know that both of the files are font files. How to solve this problem?

Update 1:

Changing default application which is set to open a file by default, does not changes the file MIME type. I selected "Font viewer" as default application for first file, but MIME type was same as before: ODF template (application/vnd.oasis.opendocument.formula-template)

Update 2:

Output of hexdump and file commands for first file ODF template (application/vnd.oasis.opendocument.formula-template):

~$ hexdump -C /usr/local/share/fonts/PATH/TO/file1.otf | head -10
00000000  00 01 00 00 00 15 01 00  00 04 00 50 44 53 49 47  |...........PDSIG|
00000010  b2 43 b4 f2 00 02 8a a0  00 00 19 14 47 44 45 46  |.C..........GDEF|
00000020  17 64 17 14 00 02 81 e0  00 00 00 8a 47 50 4f 53  |.d..........GPOS|
00000030  4b 22 51 38 00 02 4a 3c  00 00 37 a2 47 53 55 42  |K"Q8..J<..7.GSUB|
00000040  1b 4f b3 32 00 02 1a 38  00 00 30 02 4c 54 53 48  |.O.2...8..0.LTSH|
00000050  62 62 8b 22 00 00 0c 2c  00 00 02 81 4f 53 2f 32  |bb."...,....OS/2|
00000060  8f ff 72 1b 00 00 01 d8  00 00 00 60 56 44 4d 58  |..r........`VDMX|
00000070  66 17 6d 58 00 00 0e b0  00 00 05 e0 63 6d 61 70  |f.mX........cmap|
00000080  f6 42 ff 1e 00 02 82 6c  00 00 08 32 63 76 74 20  |.B.....l...2cvt |
00000090  04 7a 04 1f 00 00 5b d4  00 00 00 4c 66 70 67 6d  |.z....[....Lfpgm|
~$ file /usr/local/share/fonts/PATH/TO/file1.otf 
/usr/local/share/fonts/PATH/TO/file1.otf: TrueType font data
~$ file -i /usr/local/share/fonts/PATH/TO/file1.otf
/usr/local/share/fonts/PATH/TO/file1.otf: application/x-font-ttf; charset=binary

Output of hexdump and file commands for second file OpenType font (application/x-font-otf):

~$ hexdump -C /usr/local/share/fonts/PATH/TO/file2.otf | head -10
00000000  4f 54 54 4f 00 0a 00 80  00 03 00 20 43 46 46 20  |OTTO....... CFF |
00000010  5c 33 c3 6d 00 00 09 38  00 00 61 37 47 53 55 42  |\3.m...8..a7GSUB|
00000020  54 d2 12 5e 00 00 6d c0  00 00 05 48 4f 53 2f 32  |T..^..m....HOS/2|
00000030  d2 f6 e7 07 00 00 01 10  00 00 00 60 63 6d 61 70  |...........`cmap|
00000040  19 7f 5b 97 00 00 05 c8  00 00 03 50 68 65 61 64  |..[........Phead|
00000050  fc b9 e6 f6 00 00 00 ac  00 00 00 36 68 68 65 61  |...........6hhea|
00000060  15 93 03 22 00 00 00 e4  00 00 00 24 68 6d 74 78  |...".......$hmtx|
00000070  ac c1 fb 32 00 00 6a 70  00 00 03 50 6d 61 78 70  |...2..jp...Pmaxp|
00000080  00 d4 50 00 00 00 01 08  00 00 00 06 6e 61 6d 65  |..P.........name|
00000090  4d 67 6a ae 00 00 01 70  00 00 04 56 70 6f 73 74  |Mgj....p...Vpost|
~$ file /usr/local/share/fonts/PATH/TO/file2.otf
/usr/local/share/fonts/PATH/TO/file2.otf: OpenType font data
~$ file -i /usr/local/share/fonts/PATH/TO/file2.otf
/usr/local/share/fonts/PATH/TO/file2.otf: application/vnd.ms-opentype; charset=binary

Update 3:

File 1 link ODF template (application/vnd.oasis.opendocument.formula-template)
File 2 link OpenType font (application/x-font-otf)

5
  • What is the output of hexdump -C '/PATH/TO/FILE.otf | head -10 and file '/PATH/TO/FILE.otf, & file -i '/PATH/TO/FILE.otf for each file? N.B. If you don't think an answer is good enough don't just downvote it - stay positive :D
    – Wilf
    Feb 21, 2015 at 23:38
  • 1
    @Wilf The question is updated based on information you asked for. But there is a strange output: the output for vnd.oasis.opendocument.formula-template file contains: x-font-ttf and ouput for x-font-otf contains vnd.ms-opentype!!! About the down vote, I agree with you but i could not be cleared :(. Feb 22, 2015 at 19:01
  • If it's a TrueType font then give it .ttf ext. Otherwise maybe put both files in a folder, compress & upload somewhere & provide link. Here is pretty good - datafilehost.com
    – doug
    Feb 22, 2015 at 19:27
  • @doug - using dropbox or google drive share links (if you have them already) is a good idea as those sites can be weird... file1 could be a TTF file so try renaming it and see what happens
    – Wilf
    Feb 22, 2015 at 21:18
  • @doug @Wilf link of both files are added. But changing the file extension to ttf solved my problem. Please post it as an answer to the question. Feb 23, 2015 at 14:17

2 Answers 2

2

This is a case of the problematic file having the wrong extension.

So that threw your file manager off & may have prevented a proper preview of the file. Seeing that file UthmanTN1 Ver10.otf reports TrueType font data then simply giving it a proper ext (.ttf) should & does resolve the issue

1

Files can have different mime types but have the same extension.
That's why you should never fully rely on extension to validate your website uploads.

Take for example .jpg, all these are valid mime types:

image/pjpeg
image/jpeg
image/jpg

A list of common mime types.

2
  • Your answer just describes root of the problem, that is somewhat clear in my question. But my question is how to solve this problem! Feb 22, 2015 at 19:07
  • 1
    Your link contradicts your answer. Only valid mime type for .jpg is image/jpeg. image/jpg is not a real mime type in the first place. Nov 6, 2019 at 15:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .