engines/mod: Make format_to_extension return Vec - #93
Conversation
| } | ||
|
|
||
| if let FileFormat::Format = format { | ||
| if let OpenResult::Ok(r) = self.io.input_open_format(&ext.into_os_string(), self.status) { |
There was a problem hiding this comment.
@pkgw There is most probably a better way of doing this than by repeating OpenResult::Ok(r) twice (same below). Unfortunately, I was not able to figure one out. Do let me know if you can, I will gladly change this.
There was a problem hiding this comment.
I guess @-bindings are the preferred solution in this case:
if let result @ OpenResult::Ok(_) = compute_result() {
return result
}There was a problem hiding this comment.
Sorry, I'm not familiar with the @ syntax and I can't see the key part of the diff. @Mrmaxmeier is your example syntax equivalent to this?
if let OpenResult::Ok(r) = compute_result() {
return OpenResult::Ok(r)
}There was a problem hiding this comment.
Yup, @pkgw.*
*Recreating the enum variant inside of the if let statement could lead to lost/different type information but in this case both versions are equivalent.
| FileFormat::Format => vec!["fmt.gz"], | ||
| FileFormat::FontMap => vec!["map"], | ||
| FileFormat::MiscFonts => vec!["miscfonts"], /* XXX: no kpathsea suffixes */ | ||
| FileFormat::Ofm => vec!["ofm"], /* XXX: also .tfm */ |
There was a problem hiding this comment.
@pkgw I tried adding tfm here too, but it turns out that adding it here fails the test_space test -- the code actually fails at this point (https://github.com/tectonic-typesetting/tectonic/blob/master/tectonic/dpx-tfm.c#L579).
I therefore omitted it here.
There was a problem hiding this comment.
Ah ... I believe that by fixing this bug you're exposing a lingering problem in the font parsing code. I will look at this a bit more but I think the thing to do would be to file an issue about the problem and #[ignore] the failing test until the issue gets fixed.
There was a problem hiding this comment.
@pkgw Thanks, I also added a FIXME to the appropriate #[ignore] line.
| FileFormat::Tex => vec!["tex", "sty", "cls", "fd", "aux", "bbl", "def", "clo", "ldf"], /* also .{sty,cls,fd,aux,bbl,def,clo,ldf} */ | ||
| FileFormat::TexPsHeader => vec!["pro"], | ||
| FileFormat::TFM => vec!["tfm"], | ||
| FileFormat::TrueType => vec!["ttf", "ttc", "TTF", "TTC", "dfont"], /* XXX: also .ttc, .TTF, .TTC, .dfont */ |
There was a problem hiding this comment.
A bunch of the trailing XXX comments can now be removed.
There was a problem hiding this comment.
@Mrmaxmeier roger that, will do. Thanks!
There was a problem hiding this comment.
@Mrmaxmeier I left at least a few ones that are still relevant.
5207013 to
592b50b
Compare
* Make `format_to_extension` return a Vector of strings. * Make use of `set_extension` function of PathBuf instead of creating an OsString. * Add multiple vectorized values as results of `format_to_extension`. * Fixes tectonic-typesetting#78 Signed-off-by: mr.Shu <mr@shu.io>
592b50b to
7c2e4e6
Compare
|
@Mrmaxmeier @pkgw I am wondering if we can put together a test for this -- especially given the problem with |
* Make sure `.tfm` are treated in the same way as `.tfm` are. * Since the change mentioned above breaks the `test_space`, it had to be ignored. Signed-off-by: mr.Shu <mr@shu.io>
4626113 to
5becc5e
Compare
…onic into mrshu/format_to_extension-refactor
As described in tectonic-typesetting#95, more tests need to be updated. Signed-off-by: mr.Shu <mr@shu.io>
| } | ||
|
|
||
| #[test] // GitHub #31 | ||
| #[ignore] // FIXME: GitHub #95 |
There was a problem hiding this comment.
@pkgw it turns out I had to ignore a couple more tests in order for the tests to pass.
|
So, sorry — upon further investigation, I think that I was just wrong before. I now think the |
* Per current discussions in tectonic-typesetting#93, the `tfm` extension should not signify a .ofm file. * Tests can therefore be unignored. Signed-off-by: mr.Shu <mr@shu.io>
|
Commit 7c2e4e6 seems to break Engine output: |
|
Investigating this, the problem is that the file Unfortunately this breaks tectonic for me. :) I believe that we should not change the extension of the file, if provided. Actually, how is the |
|
Gah, I did not test thoroughly enough. Thanks for #100. |
use `Into<Vec<u8>>` instead of `&str`
Make
format_to_extensionreturn a Vector of strings.Make use of
set_extensionfunction of PathBuf instead of creating anOsString.
Add multiple vectorized values as results of
format_to_extension.Fixes Support more image filename extensions #78
Signed-off-by: mr.Shu mr@shu.io