* Fix copyPixels crash on Hashlink
* Move nullcheck to C++
* Simplify further
* Avoid unneccessary object allocation
* Formatting
* Simplify by using an if statement
We're currently using freetype 2.9.1's algorithm for choosing font metrics, but it's not exactly the same as SWF (but it is closer than freetype 2.10's new algorithm).
This algorithm should more closely match the font metrics used by AS3 compilers when embedding fonts with [Embed] metadata in AS3.
This allows us to upgrade freetype beyond 2.9.1 (actually, 2.8.1 due to a bug in freetype 2.9) without wildly different font metrics. The reason that we don't want to change font metrics algorithms is that freetype's new algorithm is very different than the algorithm used for SWF fonts. The older freetype algorithm is closer to SWF, so we want to stick with it.
Thankfully, freetype supports accessing various metrics stored in font files in a more raw form, so we can provide our own custom algorithm in a way that is fully supported by freetype. I just copied the existing algorithm straight from 2.9.1 to restore our preferred behavior.
I confirmed that, after this change, OpenFL renders metrics like Lime 8.1.3. But we have the same upgraded freetype as Lime 8.2.0 that we had to revert for 8.2.1.
I plan to experiment with a mode that matches SWF even more closely, now that I have a better understanding of how fonts and freetype work.
::SOURCE_FILE:: must appear on the first line so that the .js.map line numbers match with our generated .js file line numbers
Added a comment to explain why that part of the file isn't formatted nicely with line breaks like the rest of the file.
This partially reverts bbcb8bea07
* Don't run `embedBytes()` if `embedByteArray()` is also running.
Both functions insert a constructor, and one class can't have two constructors, much less call `super()` with two different signatures.
I can only assume a bug in Haxe that prevented this from being an issue until now, and that Haxe 5 is fixing the bug.
* Check for `@:autoBuild` only after checking for embed data.
If we ever decide to handle the case of the embed functions being called for non-classes (meaning `getLocalClass()` would return null), we'd handle it in `embedData()`. Therefore `embedData()` should happen first.
The ios-deploy tool no longer works with new iOS SDKs that don't have DeveloperDiskImage.dmg, but Xcode added new commands that can be used in the terminal to install and launch on connected devices.
If a custom version is configured, users will think that just pressing enter will clear it, but it won't. It'll just keep the current value. To actually clear the value, they need to run lime config remove HL_PATH instead.
This can be useful for debugging when the way that we select a simulator needs to be tweaked. For instance, I recently fixed an issue where "Unavailable" simulators could be automatically selected, but I saw only a UUID instead of the device name in the output, so it was hard to figure out which simulator had been selected.
We use a default of 72 for now to ensure text is formatted correctly. Not entirely sure why we are stuck on 72 but that is an investigation for the future.
This fixes some unexpected changes in text rendering for OpenFL which rely on a private function in Lime. Previously we defaulted at 72 dpi, which apparently is expected to layout the text properly. Most displays are 96 dpi or higher today, so we should probably look into this. For RenderGlyph, which was previously broken over several versions, we will now use a dpi of 96 for now. In the next version of lime, we absolutely should alter the function signature to allow for renderGlyph to accept a dpi argument.
tag VER-2-9-1
Starting with freetype 2.10.0, the sum of the ascent and descent values seem to be more likely to be less than the baseline-to-baseline measurement (called the font's height), which is the font designer's recommend distance between baselines. However, OpenFL doesn't account for the full baseline-to-baseline height at all, so with smaller ascent and descent values, lines render with smaller gaps between them. OpenFL needs to update its TextEngine algorithm to use the height of the line instead of adding ascent and descent together alone, and then we can update freetype. Updating TextEngine is not a trivial change, and may likely require time to discover bugs and stabilize, so it's better to roll back the freetype update for now, and apply it again later after OpenFL can handle it properly.
I think it should probably use 96 dpi instead of 72.... In the next minor version of Lime I think we should change the function sig to allow a dpi argument.