feat(system): Load Uniscribe at runtime - #3241
Conversation
PR Summary by QodoLoad required Uniscribe APIs dynamically on Windows
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can type 'qodo, fix this' on a finding and the fix lands right on your PR |
|
| Filename | Overview |
|---|---|
| Core/Libraries/Source/WWVegas/WWLib/CMakeLists.txt | Adds the loader implementation and header to the Windows-only WWLib source set. |
| Core/Libraries/Source/WWVegas/WWLib/Usp10Loader.cpp | Implements synchronized one-time loading, complete export validation, and guarded wrappers without an accepted defect. |
| Core/Libraries/Source/WWVegas/WWLib/Usp10Loader.h | Declares compatible opaque Uniscribe types, constants, wrapper signatures, and function-pointer storage. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Caller[Complex-text renderer] --> Wrapper[Usp10Loader wrapper]
Wrapper --> Load{Loader initialized?}
Load -->|No| System[Load system usp10.dll]
System --> Resolve[Resolve five exports]
Resolve -->|All present| Call[Invoke Uniscribe function]
Resolve -->|Missing or unavailable| Fallback[Return failure for renderer fallback]
Load -->|Yes| Call
Reviews (1): Last reviewed commit: "feat(system): Load Uniscribe at runtime" | Re-trigger Greptile
| #include "mutex.h" | ||
|
|
||
|
|
||
| static CriticalSectionClass Usp10LoaderCriticalSection; |
|
|
||
| bool Usp10Loader::isLoaded() | ||
| { | ||
| return load(); |
There was a problem hiding this comment.
This calling load looks strange.
Maybe return return Module != HMODULE(nullptr); ?
|
|
||
| static bool isLoaded(); | ||
|
|
||
| static HRESULT WINAPI ScriptIsComplex(const WCHAR *text, int text_length, DWORD flags); |
There was a problem hiding this comment.
Why are these made WINAPI?
I see DbgHelpLoader does the same but it probably should not have.
|
|
||
| private: | ||
|
|
||
| static bool load(); |
There was a problem hiding this comment.
The current model does not allow to unload it. Is this acceptable?
| ScriptIsComplexPtr = reinterpret_cast<ScriptIsComplex_t>(::GetProcAddress(Module, "ScriptIsComplex")); | ||
| ScriptStringAnalysePtr = reinterpret_cast<ScriptStringAnalyse_t>(::GetProcAddress(Module, "ScriptStringAnalyse")); | ||
| ScriptStringFreePtr = reinterpret_cast<ScriptStringFree_t>(::GetProcAddress(Module, "ScriptStringFree")); | ||
| ScriptStringSizePtr = reinterpret_cast<ScriptStringSize_t>(::GetProcAddress(Module, "ScriptString_pSize")); |
There was a problem hiding this comment.
Maybe keep the "_pSize" naming consistent across all variables?
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Adds a small Windows-only loader for the five Uniscribe functions required by the complex-text renderer.
The loader resolves the functions from the system
usp10.dllat runtime and reports failure to callers when Uniscribe is unavailable. This allows #3231 to retain the existing per-character renderer as its fallback while removing the compile-time dependency onusp10.handusp10.lib, which are missing from the VC6 SDK.Cross-platform text shaping remains outside this focused compatibility change.
The stacked result was validated with:
usp10.dllgit diff --checkThe change was developed with AI assistance, then manually reviewed against the nearby runtime-loader pattern and the official Windows SDK function declarations.