1. Song Tom
  2. PowerBuilder
  3. Thursday, 25 April 2019 13:48 PM UTC

Dear Appeon:

 

    We meet a  confusion, these days,  As code 128 font is used in label printing, the font is installed in the PCs, but when PC re-installed, different code 128 font with same font face name (both name "Code 128") can be installed at same PC, as different algorithm related with individual code 128 font, and the only proper algorithm can match with the correct barcode to be identified by the scanner, it cost us lot of time to find the correct font file as fonts has slight difference. whether there is a solution to use local font file (locate in application folder) rather than use the font face name installed in the window system as some Web site.

Attachments (2)
François Rossignol Accepted Answer Pending Moderation
  1. Thursday, 25 April 2019 14:21 PM UTC
  2. PowerBuilder
  3. # 1

Hi

you can load font file localy for your application. the font does not need to be installed on the PC and administrator rights are not required.

 

function long AddFontResourceExW( readonly string as_FontFile, ulong aul_FontCharacteristics, ulong aul_Reserved ) library "GDI32.dll" alias for "AddFontResourceExW"
function boolean RemoveFontResourceExW( readonly string as_FonfFile, ulong aul_FontCharacteristics, ulong aul_Reserved ) library "GDI32.dll" alias for "RemoveFontResourceExW"

constant long FR_PRIVATE = 16
constant long FR_NOT_ENUM = 32

AddFontResourceExW("\path\to\fonts\yourfont.ttf",FR_PRIVATE + FR_NOT_ENUM,0)

 

With those parameters your font will not be visible for other applications ad will be "private" to your application.

 

Now if the font you load has the same name as a system font I do not know which one will be used (I'd guess the local font). If the system font is used I'd recommend to have your local font named differently.

 

Regards,

François

Comment
  1. mike S
  2. Thursday, 25 April 2019 16:27 PM UTC
The above approach also works with PowerServer Web applications - you can have a font file downloaded and then load it using the above API.



I don't know whether there is any functionality for loading a font for PS mobile applications.
  1. Helpful
  1. Song Tom
  2. Tuesday, 30 April 2019 01:20 AM UTC
François, Thanks a lot, it can really work, when I load a local font not exist in the system
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.