Rapi and fonts ?

derez

Expert
Licensed User
Longtime User
I try to copy a font from the desktop to the fonts directory under windows in the device, using RAPIdesktop.dll

For TTF files - the file is copied but I get an error that the file cannot be opened. The same if I use copy 1 or copy 2.

For OTF files - the file is copied without complaints.

Any explanation :confused:

see the attached test file.
 

Attachments

  • test.sbp
    760 bytes · Views: 197

IoSonoPiero

Active Member
Licensed User
Longtime User
Warning that on some devices, the folder is not in \windows\fonts !!!
On my device the folder is in \windows\Caratteri
 

IoSonoPiero

Active Member
Licensed User
Longtime User
Update: this post is not useful as possible solution of resolving correctly names.

To avoid the Fonts name folder issue,
I would use the Hardware library, then get the font folder name using the sfFonts value.

B4X:
 strFontFolder = hw.GetSpecialFolder(hw.sfFonts)
 
Last edited:

IoSonoPiero

Active Member
Licensed User
Longtime User
MMhh, but if the application run on Desktop, how you can retrieve the correct Folder name on the device?

The Harware library is not usefull.

So please don't mind my previous post!
 

Cableguy

Expert
Licensed User
Longtime User
MMhh, but if the application run on Desktop, how you can retrieve the correct Folder name on the device?

The Harware library is not usefull.

So please don't mind my previous post!

Why not????
The Rapi dll is used to alow interaction between device and desktop apps, so an b4p app is considered to be also running in the device...(?).
As a last resource one could create a "companion" app to provide some feedback to the desktop app...like the correct folder name for the fonts...
 

IoSonoPiero

Active Member
Licensed User
Longtime User
Well, if you use a companion app this can be usefull, yes.

But... you oblige a user to install an application on the device to use the installer.

Because much users just download and exe and they click without reading notes on Next -> Next -> Next -> Ok, I think that this can't be THE solution.

Just my 2 cents
 

Cableguy

Expert
Licensed User
Longtime User
But... you oblige a user to install an application on the device to use the installer.
Not necessarly, on conection a single file exe can be copied to the device and then shelled, retrieved the results and then delete the copied exe on the device...
Seems a lot of work, but is one of the ways to get info FROM the device REMOTLY....and all it takes is a few extra lines of code to get the info one really needs.
 

IoSonoPiero

Active Member
Licensed User
Longtime User
You're right!

I don't know that the Rapi can shell an application, neved used it, good to know.

So, the Hardware library can be used to obtain various information directly from the device and to perform various operations that from the Windows Desktop can be difficoult to do, like avoiding the error on copying the font files, I think.
 
Last edited:

derez

Expert
Licensed User
Longtime User
Guys
You are off track on this issue (at least from my point of view) -
The problem is not due to different name - because the name as I see it in the emulator is Fonts.
Anyway - my installation program lets the user find the correct directory (in the case that he read the instructions) and this will cover the case of other languages names for the directories.

There must be a difference between a "standard" file and a font file that cause RAPI to have this error.
 
Last edited:

IoSonoPiero

Active Member
Licensed User
Longtime User
Maybe the TTF file on your PC has different attributes than OTF (for example, Hidden, System etc)?
 

Cableguy

Expert
Licensed User
Longtime User
Sorry Derez, I let myself go in Ghale thinking...
Have you tried to change the file extention, and then rename it on the device side?
 

derez

Expert
Licensed User
Longtime User
I didn't, but even if it will work - it does not count as a solution, since the program and the installation data file do not recognize the files, just folders which contain files.

I'll check.

edit: Checked, the ttf does cause error, other ending don't.
and the RAPI cannot rename, it can copy inside the device but I believe it is the same problem. Something in this type of file (true type) cause the problem.
 
Last edited:

Cableguy

Expert
Licensed User
Longtime User
Do you have the same problem in ActiveSync? is it just the rapi?
 

IoSonoPiero

Active Member
Licensed User
Longtime User
I've create a very small code to copy ttf files into the Fonts folder.
Well, it works.

I think the lock it's related to Windows that locks one or more ttf file (or with others extensions, too) if they are used.

Try to soft-reset device and try again then tell me what happen, please.

Update:
After I've copied some ttf files in Fonts folder and after a soft reset, all files I've copied are now LOCKED!
 
Last edited:

IoSonoPiero

Active Member
Licensed User
Longtime User
The only way to get rid of locked fonts is to rename them on the device and then delete them.

With some Explorer-like apps, like Resco, you can simply delete the locked files.
 

derez

Expert
Licensed User
Longtime User
With activesync I can copy a file into the folder, but if I want to delete it right away - I can't, it says it is in use !
 

IoSonoPiero

Active Member
Licensed User
Longtime User
Yes, I've understood. I've only explained what's happening on the files in that folder.

The only remedy is to rename them.
 

BjornF

Active Member
Licensed User
Longtime User
Well actually I think you can do it, if you are willing to use MortScript, there is a command there for setting the fileattributes. You would of course then need to run a shellcommand to get that to work (and install MortScript where you need it).

Mortscript is a very capable script program, freeware, from www.sto-helit.de - Main page

I have used it in other applications when I have needed things that Basic4PPC couldn't (then) do... http://www.b4x.com/forum/code-samples-tips/255-copy-paste-device.html

all the best / Björn
 

derez

Expert
Licensed User
Longtime User
Thanks Björn but I am trying to write a simple (= for me simple means that I can understand and control the code) , and adding "external" utilities is actually what we already have in "Setup Builder" in b4ppc.

So - I prefer to find "internal" solution to the fonts :sign0137:
 

ExcludeReality

Active Member
Licensed User
MortScript is practicly built in Basic4ppc!
Well, I'm not sure, but it's a fact that Basic4ppc does everything MortScript does.

Some of the functions are just buried in the libraries, but I'm sure there's a way to change the attributes in Basic4ppc
 
Top