-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve font loader #138
base: main
Are you sure you want to change the base?
improve font loader #138
Conversation
Would it be better to have this behave as a search path? In other words, each of the directories in the list are searched in turn when a font is requested. That way, if the font is found in any of the directories, it is found (rather than only considering the first existing directory?). My suggestion is to make this a list of paths, and update the logic which opens a path to loop over all the paths until a hit is found. What do you think? |
Thank you for your reply! And I think the suggestion you said, that is what the code does. It loops every path in the list until it hits a path, depending on their OS and figlet installation(they can submit a PR to add a directory to search for on that list) to make it cross-platform. correct me if I'm wrong because english is not my primary language, thanks again! |
Hi, No problem. Happy to explain so feel free to keep asking if you still don't understand, and there is no urgency so we can take our time. What I understand you've done is change the initialisation so that it chooses the first directory which is found as the directory which is searched. Given a font lookup, there is exactly one directory checked to see if it has that font. What I think users may prefer is if all of the directories are checked. To achieve this I think If I become unresponsive, please feel free to ping the thread once weekly (ideally late on a Thursday or early on a Friday). |
Thank you so much for your consideration and time! sure, no worries I will do that |
Note that this isn't the only place |
Thank you for the reply! Yes, I took note of that the By the way please bear with me, I'm just learning about your codebase and always open to learn from more experienced people. Thanks again for the note you gave! |
@diamant3 I think you've not understood what is being asked for. What @peterbrittain and myself are thinking is that there needs to be a function, There shouldn't be any module-level execution, only a module level variable, Does that make sense, and do you see how this is different from what you have implemented so far? |
I'm sorry, Yes it's so huge different on my implementation, thank you so much! I will rewrite this and make an update next week. |
Hello, Can i request a review and test my PR, thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just a few quick tweaks please...
Thank you so much! sure no worries, just a minute edit: it's done, thanks! |
Sorry if I wasn't clear before but this is still not quite what I envisaged. You've made this into a function which gets called when it's needed, that's good; but the function needs to take a font to search for as a parameter. Because the font may not exist in "the first directory found", but may exist in a later one, and different fonts may be found in different directories. Listing all fonts should likewise consult all directories and return the union of all fonts installed in all directories. Does what I'm asking for seem reasonable? |
Yeah - I wondered about this, but stuck with simplicity. Happy for you to override that as owner of the project, though. I see two issues:
Both possible to do, but both will need testing. |
That's on me, my bad. Yes, that's reasonable no worries. So this
Thank you so much for the permission!, and got it that issues i need to take note and needs to change according to |
It's not necessarily one function. You need to consider three pieces of functionality of the software:
|
Heavy plus 1 for what @pwaller said! |
Hello, so I implement the logic from pwaller's said to my best understanding, can i request again for review and as always, thank youu. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies the ball got dropped on this one. I see you marked the PR as draft (rather than ready to review), is that your intended state? I've left another comment.
@@ -142,12 +144,20 @@ def preloadFont(cls, font): | |||
if path.exists(): | |||
font_path = path | |||
break | |||
else: | |||
for location in ("./", SHARED_DIRECTORY): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This previously checked $PWD as well as SHARED_DIRECTORY. I think we should preserve the existing behaviour.
pyfiglet -l
like this:fix for #86