Skip to content

Conversation

ctrlcctrlv
Copy link
Member

We're including the wrong path when the features.fea include path is
relative. It's supposed to be relative to the directory the UFO is in,
not relative to features.fea.

I fixed this by following @skef's advice of checking the correct
directory first, and if it fails, then trying the deprecated directory,
and emitting a warning.

Close #4629

Type of change

  • Bug fix

@skef
Copy link
Contributor

skef commented Mar 26, 2021

@ctrlcctrlv should we pick this back up again?

@ctrlcctrlv
Copy link
Member Author

Yes, we should. Apologies for long delay.

@ctrlcctrlv ctrlcctrlv force-pushed the ufo_include branch 2 times, most recently from 9994061 to 2b31642 Compare May 15, 2021 12:27
@dimasnirwan

This comment has been minimized.

@ctrlcctrlv

This comment has been minimized.

@ctrlcctrlv ctrlcctrlv requested a review from jtanx May 17, 2021 00:31
@ctrlcctrlv
Copy link
Member Author

Sorry to bug you @jtanx, but this is impeding my work. I know it's mostly my fault it's sat so long, but hopefully there have been enough rounds of review? :-)

Copy link
Contributor

@jtanx jtanx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, one more but I think that's it

filename, tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
++tok->err_count;
free(filename);
in_deprecated = fopen(filename_deprecated, "r");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this leaks filename and filename_deprecated in the opposite case. I think you can also get away without having in_deprecated. Maybe:

in = fopen(filename, "r");
if (in == NULL) {
    if (filename != filename_deprecated) {
        free(filename);
        filename = filename_deprecated;
        in = fopen(filename, "r");
    }
    if (in == NULL) {
        LogError(...cantopen...);
        ++tok->err_count;
        free(filename);
        return;
    }
    LogError(...deprecated...);
} else if (filename != filename_deprecated) {
    free(filename_deprecated);
}

We're including the wrong path when the features.fea include path is
relative. It's supposed to be relative to the directory the UFO is in,
not relative to features.fea.

I fixed this by following @skef's advice of checking the correct
directory first, and if it fails, then trying the deprecated directory,
and emitting a warning.

Close fontforge#4629
@ctrlcctrlv ctrlcctrlv merged commit a24d785 into fontforge:master Jun 9, 2021
@ctrlcctrlv ctrlcctrlv mentioned this pull request Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Including files in UFO features.fea files: Our implementation is wrong
5 participants