boten Active Member Licensed User Longtime User May 13, 2018 #1 I have 2 HTML files, both contain identical text (in Hebrew). The difference is that frnk.htm links to stylesheet p.css, while reg.htm does not. stylesheet p.css defines FrankRuehl font in file frank.ttf all 4 files: frnk.htm reg.htm p.css frank.ttf are copied to DirInternal. A button switch a webview display between frnk.htm / reg.htm Compiling and running on Galaxy S4, android 4.2.2: FrankRuehl font is shown and on button click switch to default font compiling and running on Galaxy S7, android 7.0: default font is shown both files, FrankRuehl not shown. Attached is the project, and 2 images, each containing 2 screenshots Attachments hebtest.zip hebtest.zip 38.3 KB · Views: 333 s4-screens.jpg 193.3 KB · Views: 458 s7-screens.jpg 173.9 KB · Views: 423
I have 2 HTML files, both contain identical text (in Hebrew). The difference is that frnk.htm links to stylesheet p.css, while reg.htm does not. stylesheet p.css defines FrankRuehl font in file frank.ttf all 4 files: frnk.htm reg.htm p.css frank.ttf are copied to DirInternal. A button switch a webview display between frnk.htm / reg.htm Compiling and running on Galaxy S4, android 4.2.2: FrankRuehl font is shown and on button click switch to default font compiling and running on Galaxy S7, android 7.0: default font is shown both files, FrankRuehl not shown. Attached is the project, and 2 images, each containing 2 screenshots
Erel B4X founder Staff member Licensed User Longtime User May 13, 2018 #2 Tip: Code: Copy Sub Copy2Int(Fn As String) If File.Exists(File.DirInternal,Fn) Then File.Delete(File.DirInternal,Fn) File.Copy(File.DirAssets,Fn,File.DirInternal,Fn) End Sub 1. You don't need to check whether a file exists before you try to delete it. Nothing happen if it doesn't exist. 2. You don't need to delete the target file before you copy. It will be overwritten anyway. Your code does work on Nexus 5X running Android 8. I don't know whether it is related or not (probably not) however there is an extra slash in the URL. Better to write it like this: Code: Copy s="file://" & File.Combine(File.DirInternal, "frnk.htm#begin") Upvote 0
Tip: Code: Copy Sub Copy2Int(Fn As String) If File.Exists(File.DirInternal,Fn) Then File.Delete(File.DirInternal,Fn) File.Copy(File.DirAssets,Fn,File.DirInternal,Fn) End Sub 1. You don't need to check whether a file exists before you try to delete it. Nothing happen if it doesn't exist. 2. You don't need to delete the target file before you copy. It will be overwritten anyway. Your code does work on Nexus 5X running Android 8. I don't know whether it is related or not (probably not) however there is an extra slash in the URL. Better to write it like this: Code: Copy s="file://" & File.Combine(File.DirInternal, "frnk.htm#begin")
boten Active Member Licensed User Longtime User May 13, 2018 #3 Erel said: Tip: 1. You don't need to check whether a file exists before you try to delete it. Nothing happen if it doesn't exist. 2. You don't need to delete the target file before you copy. It will be overwritten anyway. Click to expand... agree on both. however they do no harm to copying the files Your code does work on Nexus 5X running Android 8. I don't know whether it is related or not (probably not) however there is an extra slash in the URL. Better to write it like this: Code: Copy s="file://" & File.Combine(File.DirInternal, "frnk.htm#begin") Click to expand... Did you see FrankRuehl font on the Nexus5x? // brings the same result as /// (i'm used to file:/// from windows' browsers) So still wondering the "glitch" in galaxy S7+android 7.0 Upvote 0
Erel said: Tip: 1. You don't need to check whether a file exists before you try to delete it. Nothing happen if it doesn't exist. 2. You don't need to delete the target file before you copy. It will be overwritten anyway. Click to expand... agree on both. however they do no harm to copying the files Your code does work on Nexus 5X running Android 8. I don't know whether it is related or not (probably not) however there is an extra slash in the URL. Better to write it like this: Code: Copy s="file://" & File.Combine(File.DirInternal, "frnk.htm#begin") Click to expand... Did you see FrankRuehl font on the Nexus5x? // brings the same result as /// (i'm used to file:/// from windows' browsers) So still wondering the "glitch" in galaxy S7+android 7.0
Erel B4X founder Staff member Licensed User Longtime User May 13, 2018 #4 boten said: Did you see FrankRuehl font on the Nexus5x? Click to expand... Yes. As a general rule you should avoid using WebView to implement the interface. You can use xCustomListView with AddTextItem to implement it with the native views. Upvote 0
boten said: Did you see FrankRuehl font on the Nexus5x? Click to expand... Yes. As a general rule you should avoid using WebView to implement the interface. You can use xCustomListView with AddTextItem to implement it with the native views.