airsdk / Adobe-Runtime-Support

Report, track and discuss issues in Adobe AIR. Monitored by Adobe - and HARMAN - and maintained by the AIR community.
197 stars 11 forks source link

Android 12 _sans Chinese text display garbled #1299

Open a9848840 opened 2 years ago

a9848840 commented 2 years ago

Hi

I use text field default system word _sans Chinese text display garbled

"_sans" "_serif" "_typewriter" also garbled □□□...

I googled Android 12 sans, this part has some adjustments, Can you help adjust the Chinese display as soon as possible?

thank you

Android 12 AirSDK : 33.1.1.633 / 33.1.1.554

wmtj commented 2 years ago

I have the same problem too.

a9848840 commented 2 years ago

Android12 About sans https://source.android.com/compatibility/android-cdd#3813_unicode_and_font

wmtj commented 2 years ago

@ajwfrost Is there any plan to fix this bug ? All Chinese characters are not displayed correctly on android 12.

ajwfrost commented 2 years ago

Yes, one of the team is looking into this one currently Thanks

Ender22 commented 2 years ago

This is a huge issue for my app as well, happy you guys are looking into it already, thanks~

funyamora commented 2 years ago

I have the same problem in Japanese including Chinese Characters. But using Flash Text Engine without TextField, characters don't garbled. https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/engine/package-detail.html

Devin-Licastro commented 2 years ago

Glad to hear someone is looking into this. Please ensure it is a priority. We have a lot of users who need our app's interface in Chinese and it's been over a month where some of them can't use our app.

Also, this should be labeled as a bug, not a feature right? All the Chinese text in air apps displaying as [] when users update android is certainly a bug, isn't it? Just hoping it doesn't get a lower priority when labeled this way.

ajwfrost commented 2 years ago

@Devin-Licastro are you seeing this issue on anything other than devices running Android 12? Would definitely class it as a bug if it's happening on Android 11 ..

Anyway: we just spoke on this and I'm hoping we can get a beta release uploaded within the next 7-10 days with all the Android 12 / API 31 changes.

Devin-Licastro commented 2 years ago

No only on Android 12. Thanks for the details about the coming release.

wmtj commented 2 years ago

I hope Harman will fix this bug as soon as possible. @ajwfrost

a9848840 commented 2 years ago

@ajwfrost

Please help grateful

ajwfrost commented 2 years ago

Yes we're working on the updates needed here: it's actually causing a lot more work than we thought, because we're having to update the gradle version that's used for building all of the AIR runtimes and supporting tools for the Android targets, and the original build files hadn't been updated for quite some time.. but we're making progress and hoping to get this out within the next week or two.

thanks

a9848840 commented 2 years ago

@ajwfrost

Is it possible before Christmas?

thanks

ajwfrost commented 2 years ago

@a9848840 very possibly - we have it building now so need to do some other related updates and then kick off the release process..

a9848840 commented 2 years ago

@ajwfrost

I am looking forward to this version, and I hope you can tell me if there is an update,

thank you

ajwfrost commented 2 years ago

Yes so we'd got it all building and sorted out the last issues, with Android 12 / SDK 31; our earlier checks using this version suggested that it would just fix this font issue .. but having created the build, it appears this is not the case....

So we're checking it again, I hope to get an update tomorrow. We'll be going ahead with a release (at least making it available, beta-style) so that folk can get the update for this and the other changes as needed, but I'm not sure whether it will have solved this one I'm afraid. If it is just a configuration issue, which I'm hoping, then it may be that we can have this sorted out with the new build, but I don't yet have a final answer..

thanks

ajwfrost commented 2 years ago

Update on this issue .. we had originally believed that by updating our build system - and the resource files used in the AIR SDK - to those from Android 12 / SDK 31, that the fonts would then work properly. But this doesn't seem to be the case..

What it currently looks like is that the Android 12 requirement to use the "Roboto" font as the default sans-serif font is resulting in a lack of support for Chinese characters where there is no automatic fallback. We may need to parse the provided strings to check for characters and to then request a different typeface from the system where the requested glyphs are available...

ajwfrost commented 2 years ago

Hi again... can I just confirm here what you're actually trying? There are a number of variables involved and it seems to us that it may be working in some scenarios.

The AS3 code we're using as a text case is pretty simple:

            _tfmt = new TextFormat("_sans", 30, 0);
            _txt = new TextField();
            _txt.defaultTextFormat = _tfmt;
            _txt.text = "Testing 测试  測試 characters";
            addChild(_txt);

In other words, a normal TextField object, with a TextFormat that has "_sans" as the font name.

Then when building it, there are a number of values that we use in the gradle settings that depend on what you have installed... e.g.

    compileSdkVersion 30
    buildToolsVersion "30.0.3"
    defaultConfig.targetSdkVersion 30

You can change these by changing what Android build tools and platforms you have downloaded, so e.g. in your Android SDK manager if you've downloaded build-tools 31 then you'll get buildToolsVersion "31.0.0" and if you've downloaded Android "S" then you'll get compileSdkVersion 30 You can also change the targetSdkVersion via your application descriptor file: it defaults to 30 currently, and with our ongoing updates it would change to 31, but you can do that manually anyway.

The problem I have is that when I try this with a recent AIR SDK, I'm seeing the Chinese text appear (Google Pixel 5, Android 12). Even with '30' set for everything.. Are you able to upload a small APK file that is exhibiting the problem and we'll try to analyse it to see what the problems are? And are you also just able to re-check on the latest SDK version, in case you're still using 33.1.1.633?

thanks

a9848840 commented 2 years ago

Hi @ajwfrost apk using 33.1.1.554

I will also test AIR 33.1.1.713 Because the build process has changed Need to adjust

thanks for the reply

wmtj commented 2 years ago

@ajwfrost Now, more and more phones are upgrading to Android 12, This bug is becoming a disaster for my app. I ran a series of tests and invited my users to help me test it:

The result: Pixel 3/XL, Pixel 4/XL, MI 10S, MI 11/Ultra, OPPO Reno5 Pro+ 5G ... All, does not work!

AIR SDK : 33.1.1.713 TargetSdkVersion : 30 Addroid SDK : android-31

The code : `
private function addTextFields():void {

        var _tfmt:TextFormat = new TextFormat("_sans", 60, 0);
        _tfmt.align = TextFormatAlign.CENTER;

        var _txt1:TextField = new TextField();
        _txt1.defaultTextFormat = _tfmt;
        _txt1.text = "Testing Chinese characters.";
        _txt1.width = _txt1.textWidth + 4;
        _txt1.x = 100;
        _txt1.y = 400;

        var _txt2:TextField = new TextField();
        _txt2.defaultTextFormat = _tfmt;
        _txt2.text = "简体中文测试,繁體中文測試。";
        _txt2.width = _txt2.textWidth + 4;
        _txt2.x = 100;
        _txt2.y = 600;

        var _txt3:TextField = new TextField();
        _txt3.defaultTextFormat = _tfmt;
        _txt3.text = "is 'Roboto' Font exist ? -- " + isFontExist("Roboto", true);
        _txt3.width = _txt3.textWidth + 4;
        _txt3.x = 100;
        _txt3.y = 800;

        addChild(_txt1);
        addChild(_txt2);
        addChild(_txt3);}`

The screenshots & apk:

wmtj commented 2 years ago

This bug has not been solved for more than 2 months. Please pay more attention to it and do not abandon non-English users. @ajwfrost

ajwfrost commented 2 years ago

Hi

We've been working on this, there are a number of challenges here that are due to how the text drawing was originally implemented (and curiously, I think this may also be behind why there are also emoji limitations on Android..). We had thought at first that this was to do with a change in Android 12 itself and needed to update our build system and compilation/target API levels to Android SDK level 31 - the release for which is just uploaded as a beta - but this then turned out not to affect it.

We now need to update the mechanism needed for font drawing which is taken from Android 4.0 - and for compatibility we need to build Android 4 in order to do this (it uses C++ code that's not part of the NDK...), and this is now causing us some problems, so we're looking at workarounds to maybe split the supported rendering mechanism depending on what version of Android the device is running.

We're also investigating how bad it would be if we switched to actually using the Android SDK to do the text drawing. This would be the most compatible and straightforward solution, but there are no NDK APIs for these sorts of operations so there will be a hit to call back into Java (which will then call back into the underlying C++ implementation). The plus side is that it would behave a lot more like 'normal' Android applications would..

So yes, apologies that this has dragged on, we are working on it though!

One quick thought that's just occurred to me: since the problem you're seeing is due to the Roboto font not supporting these characters, and the normal fallback mechanism is the part that's actually failing within the AIR code, could you try specifying a font that already supports these characters such as "NotoSansCJK"? (i.e. rather than "_sans" which translates to "Roboto", can you set "NotoSansCJK" as the font family?) - I'll see if one of the guys here can check this out or try a few of the different fonts, the file for NotoSansCJK appears to not be a normal truetype font format so I don't actually know whether the code from Android 4 would cope with it..

thanks

wmtj commented 2 years ago

Does the 'quick thought' means : new TextFormat("Noto Sans CJK SC", 60, 0) , like this? I have tested it. @ajwfrost

The phone for testing : Pixel 3 XL (Android 12) MI K40 (MIUI 12.5.19, Android 11)

No matter what font family I set, it looks the same. In other words, changing the font family name doesn't work at all and the display is always same with _sans.

[Screenshots2.zip]() [src.zip]()

wmtj commented 2 years ago

Another information :

I bought cloud device testing service form testin.cn , there are two categories of Android 12 phones : "12" and "12(Android S)". All the phones under "12(Android S)" work fine, but all the phones under "12" does not work (garbled □□□). I asked their customer service, they only told me there are minor version number differences of the android 12. Detailed version number information is not available now. I hope you found this information helpful. @ajwfrost

[Screenshots3.zip]()

mucoci commented 2 years ago

I have the same problem, but I solved it temporarily...

My players reported this bug to me, too and their phones are all Pixel series + android 12 finally, I guess ....it must lack certain a font...

Then, I embedded a Font in my game...and use it in TextField(use .embedFonts = true) all the problem is solved...

if you guys are in a hurry, you could try this method first

Devin-Licastro commented 2 years ago

Just want to add that for my project, we have too many languages with glyphs (and huge font files) to support so this is not an option for us. I couldn't successfully embed that many fonts into my app. Still eagerly awaiting the fix.

ajwfrost commented 2 years ago

Hi

Yes I assumed that you'd need to use the device fonts for a reason ... well we have a new mechanism for text rendering which uses the "normal" Android drawing routines. There are some issues still with positioning/scrolling and transparency that we're working through but it shouldn't take too much longer - I'll try to get you a preview version asap..

thanks

yutfa commented 2 years ago

I have the same problem, but I solved it temporarily...

My players reported this bug to me, too and their phones are all Pixel series + android 12 finally, I guess ....it must lack certain a font...

Then, I embedded a Font in my game...and use it in TextField(use .embedFonts = true) all the problem is solved...

if you guys are in a hurry, you could try this method first @mucoci

Embedding fonts can only solve normal text, input text is still garbled

mucoci commented 2 years ago

I have the same problem, but I solved it temporarily... My players reported this bug to me, too and their phones are all Pixel series + android 12 finally, I guess ....it must lack certain a font... Then, I embedded a Font in my game...and use it in TextField(use .embedFonts = true) all the problem is solved... if you guys are in a hurry, you could try this method first @mucoci

Embedding fonts can only solve normal text, input text is still garbled

so... it is not a perfect solution... just a temporary one...unless your input text only including a-z, A-Z or other symbol

a9848840 commented 2 years ago

Hi @ajwfrost

I use Air 33.1.1.743 But the problem is not solved I hope you will continue to finish thanks

matrix3d commented 2 years ago

fast!

ajwfrost commented 2 years ago

Yes we're still looking at it - struggling with the mixture of drawing in Java and then compositing onto a surface in C++ that may actually be an Android bitmap or an OpenGL texture. The earlier code just short-cutted all of that but used private non-NDK code and libraries that are then not working properly with Android 12 hence the issue.

Currently (with our work in progress), text drawn with a background colour will be fine. It's just blending this onto any existing background that's causing a problem..

Devin-Licastro commented 2 years ago

I would feel a bit better if you had said "this is our top priority" rather than "we are still looking at it".

Our app is a b2b corporate training platform and we're working with clients in China, HongKong, Taiwan, Korea, and Japan that are all heavily impacted by this issue. Every day more and more phones are launching android 12 updates and more and more of our users can't use the app anymore.

Our clients are freaking out that they paid us for this service that we can no longer provide. We've already had to take a large financial hit as we've needed to offer discounts to affected clients, not to mention the potential churn we will face during the next contract renewal periods. These discounts and our attempts to reassure them a fix is coming while begging them for more time won't hold them off much longer. This is an absolute disaster for us and could mean the end of our business entirely if it isn't handled soon.

Please, please, put all of your resources into this. What else could be more important than a critical issue that renders a significant percentage of your userbase unable to use Air at all anymore?

ajwfrost commented 2 years ago

Thanks for the perspective/impact .. I've had someone working on it full time but I think we suffered from an initial misdirection and then more recently a problem where the existing behaviour wasn't properly understood. We're at a point now where the cpu-mode rendering is working and we're trying to resolve problems with the direct-mode rendering.

I think it may be worth us also sending you a test file so that you can double-check the fix (and so you can push it out if you find it works) - can you confirm if you do use cpu renderMode, or do you need direct mode?

thanks

Devin-Licastro commented 2 years ago

Our project is starling/feathers based so we need the direct mode, unfortunately.

ajwfrost commented 2 years ago

Okay .. although actually I think if you're using Feathers, you're likely to be drawing a text field to a bitmap data object, which is a separate thing (and still cpu-based, as the Feathers framework would then upload this into a texture for display). Will double-check that this part is working..!

ajwfrost commented 2 years ago

Hi @Devin-Licastro, @matrix3d, @a9848840 - if you're able to double-check what happens if you use the below runtime build (for armv8, on top of the latest SDK or anything above 698 I think), it would be good to get some "real" feedback!

https://transfer.harman.com/message/YOGggmbg3i7vblG8VMUfTl

thanks

matrix3d commented 2 years ago

can you make three new api. var bmd=Font.getBmd("abc"); Font.drawToBmd(); Font.drawToTexture();

a9848840 commented 2 years ago

Hi @ajwfrost

I use Air 33.1.1.743 https://transfer.harman.com/message/YOGggmbg3i7vblG8VMUfTl change Runtime.apk crash log

android12.txt

01-25 10:54:00.589 575 585 D libnos_transport: Calling App 2 with params 0x0000 01-25 10:54:00.590 575 585 E libnos_datagram: can't send spi message: Try again 01-25 10:54:00.595 575 585 E libnos_datagram: can't send spi message: Try again 01-25 10:54:00.601 575 585 E libnos_datagram: can't send spi message: Try again 01-25 10:54:00.606 575 585 E libnos_datagram: can't send spi message: Try again 01-25 10:54:00.612 575 585 E libnos_datagram: can't send spi message: Try again 01-25 10:54:00.617 575 585 E libnos_datagram: can't send spi message: Try again 01-25 10:54:00.625 575 585 D libnos_transport: App 2 inspection status=0x00000000 reply_len=0 protocol=1 flags=0x0000 01-25 10:54:00.625 575 585 D libnos_transport: Send app 2 command data (66 bytes) 01-25 10:54:00.626 575 585 D libnos_transport: Send app 2 go command 0x00020000 01-25 10:54:00.626 575 585 D libnos_transport: Polling app 2 01-25 10:54:00.659 575 585 D libnos_transport: App 2 poll=16 status=0x80000000 reply_len=0 flags=0x0000 01-25 10:54:00.660 575 585 D libnos_transport: App 2 polled=16 status=0x80000000 reply_len=0 flags=0x0000 01-25 10:54:00.660 575 585 D libnos_transport: App 2 returning 0x0 01-25 10:54:00.774 1704 1937 I system_server: Explicit concurrent copying GC freed 1846195(70MB) AllocSpace objects, 111(5192KB) LOS objects, 71% free, 38MB/134MB, paused 655us,67us total 180.136ms 01-25 10:54:00.782 984 2459 I sensors-hal: [ssc_utils]get_qmi_debug_flag:243, support_qmi_debug : false 01-25 10:54:00.794 1704 1937 I ActivityManager: Force stopping PackageName appid=10650 user=0: pkg removed 01-25 10:54:00.815 984 2459 I sensors-hal: [ssc_utils]get_qmi_debug_flag:243, support_qmi_debug : false 01-25 10:54:00.844 1704 1721 W System : A resource failed to call close. 01-25 10:54:00.844 1704 1721 W System : A resource failed to call close. 01-25 10:54:00.844 1704 1721 W System : A resource failed to call close. 01-25 10:54:00.846 1704 1721 W System : A resource failed to call release. 01-25 10:54:00.847 1704 1721 W System : A resource failed to call close. 01-25 10:54:00.849 1704 1721 W System : A resource failed to call close. 01-25 10:54:00.870 1704 1721 W System : A resource failed to call close. 01-25 10:54:00.872 1704 1721 W System : A resource failed to call release. 01-25 10:54:00.872 1704 1721 W System : A resource failed to call close. 01-25 10:54:00.873 1704 1721 W System : A resource failed to call close. 01-25 10:54:00.890 9354 9354 E AppButtonsPrefCtl: Exception when retrieving package:PackageName 01-25 10:54:00.890 9354 9354 E AppButtonsPrefCtl: android.content.pm.PackageManager$NameNotFoundException: PackageName 01-25 10:54:00.890 9354 9354 E AppButtonsPrefCtl: at android.app.ApplicationPackageManager.getPackageInfoAsUser(ApplicationPackageManager.java:241) 01-25 10:54:00.890 9354 9354 E AppButtonsPrefCtl: at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:213) 01-25 10:54:00.890 9354 9354 E AppButtonsPrefCtl: at com.android.settings.applications.appinfo.AppButtonsPreferenceController.retrieveAppEntry(AppButtonsPreferenceController.java:368) 01-25 10:54:00.890 9354 9354 E AppButtonsPrefCtl: at com.android.settings.applications.appinfo.AppButtonsPreferenceController.refreshUi(AppButtonsPreferenceController.java:656) 01-25 10:54:00.890 9354 9354 E AppButtonsPrefCtl: at com.android.settings.applications.appinfo.AppButtonsPreferenceController.refreshAndFinishIfPossible(AppButtonsPreferenceController.java:504)

matrix3d commented 2 years ago

we have code the embedFonts.it is works fine

matrix3d commented 2 years ago

and the stagetext also worked

a9848840 commented 2 years ago

Because my app is not small Lots of places with text fields If it can be solved once That's the best result

matrix3d commented 2 years ago

我昨天用几个小时就解决了,动态加载字体swf。多了5m的大小。我们程序只需要改2个地方就可以了。

matrix3d commented 2 years ago

网络上的动态加载字体代码都是错的。昨天自己研究了一套方案

ajwfrost commented 2 years ago

@a9848840 interesting log .. thanks for that. The failure is a null pointer when calling memcpy - the destination address is zero. Looking at the register values and decompiling the code, it seems we've got a zero-width bitmap being passed in for some reason, which we're not properly handling.

Just building an updated version and will post it here as soon as it's ready..

thanks

ajwfrost commented 2 years ago

@matrix3d

can you make three new api. var bmd=Font.getBmd("abc"); Font.drawToBmd(); Font.drawToTexture();

Can you clarify the suggestion here? The first one seems like you want a bitmap data from passing a text string to a Font object but there's no setting of size/colour/etc in there? Not sure about the drawToBmd/drawToTexture options, the first one presumably would be the same as getBmd?

If you're looking for a new/utility API to help with the generation of bitmapdata or texture objects based upon text strings and fonts, can you please raise a new issue and tag it with 'feature'?

thanks

matrix3d commented 2 years ago

https://github.com/airsdk/Adobe-Runtime-Support/issues/1597

ajwfrost commented 2 years ago

Thanks

@a9848840 please re-try with this one: https://transfer.harman.com/message/hLsy3H0EPZe8SsUuZJXi8A

thanks

a9848840 commented 2 years ago

Hi

@ajwfrost charh log android12_1.txt

The device is not Android 12, but the crash still occurs The time when the crash occurred, which is slower than the last Runtime

ajwfrost commented 2 years ago

Thanks @a9848840 .. that's a curious one. Is it possible to get an apk-debug build of your app so that we can test it here? (plus any repro steps)? https://transfer.harman.com/requests/UOoiRrt3Y4QS1u2MKC3Gsg thanks