Hi

Thanks for the reply.

<<<The question is, how do we know which index we want from the ttc if we have 
a user is asking for "Batang, bold" for example?>>>

I have not looked at freetype source or spec to see how index is assigned to 
each font in the file. But I guess it should be in the same order as they 
appear in the ttc header. Since windows api can place us at the beginning of 
the font we want, I guess we can match the name of the font (fullname) with 
each of fonts in the file and obtain the index. This is what I can think of 
right now. (I cannot exactly be sure if this would be more or less complecated 
than the current patch I sent. )
The patch I sent is perfectly fine for windows as of now. Since this works fine 
I would suggest this to be merged now. If non-windows systems implement the 
part of obtaining correct face index for ttc files, the windows part also may 
be re-implemented for uniformity.

Regards
Ali

From: dennis [mailto:dennis.v...@dots.de]
Sent: Wednesday, August 31, 2016 12:43 PM
To: podofo-users@lists.sourceforge.net
Subject: Re: [Podofo-users] TTC font related issues in Windows


Hey,

Perfect! Thank you for testing this so in depth!

You are right about your point of trusting the windows API; i just had too many 
problems working with it in other places so i'm always sceptical about it.

I never used Freetype in PoDoFo (or in general), so my knowledge about it is 
minimal, but always passing index 0 to a ttc is definitly wrong if you want 
something else then ... well the first font in the ttc ^_^

The question is, how do we know which index we want from the ttc if we have a 
user is asking for "Batang, bold" for example?



Greetings,
Dennis



PS: im happy to see someone else working on Fonts :-)
Am 29.08.2016 um 19:28 schrieb Jaseem Ali K T:
Hi

Thanks for the reply

I did some tests. I have a system with Japanese language. I set the system 
locale to Russian , Arabic etc and tested the code. I was able to get Meiryo 
font. I tested other fonts too and I was able to get others also.

We do , after all ,depend on windows API, to get the font file buffer. If we 
can trust the API to give the correct file buffer(for the font), I think we can 
trust the same API(we are using the same function) in helping us to extract the 
correct font also.(The only problem is it is closed source, and we would not be 
able to debug. We'd just have to trust them. But , since the code is already 
running on windows we are already 'trusting' them many places)

The pre-patch code didn't have fontstyle matching. Introducing this to 
pre-patch code, may require, that we have to take care of font style names in 
each language, locale etc. And we are not sure what other things we are going 
to miss.
.......

May be a more refined approach would be pass the correct face index to freetype 
library (In place of the logic for extracting the font by adjusting offsets) . 
(Side Note: what I understand by reading podofo code is that, in non-windows 
systems, the fontmanager will give the path of the required font, and this is 
passed to freetype library as FT_New_Face( *pLibrary, pszFilename, 0, &m_pFace 
);
Here the face index is always zero. Which means we always load the first font 
of the ttc file, which may not be what we wanted. )
..........


Regards
Ali

From: dennis [mailto:dennis.v...@dots.de]
Sent: Monday, August 22, 2016 12:38 PM
To: 
podofo-users@lists.sourceforge.net<mailto:podofo-users@lists.sourceforge.net>
Subject: Re: [Podofo-users] TTC font related issues in Windows

Hey there,

I was on vacation so i didnt read emails :-)

Regarding the patch:
Looks good, according to msdn this should work fine...
I dont really like the use of the Windows API and i am unable to test this 
patch atm due to time limitations (can you believe it? I have to do work at my 
workplace ;-) ).
The code looks fine, if Jaseem has tested it, it should be ok.

Why do i not like the Windows api approach?
First of all :
The pre-patch code did all kinds of locale checks, encoding checks etc. this 
needs to be done if working with ttc/ttfs.
This seems to be all hidden in the windows api call... if this code does not 
work the way we want it to work it will be very hard to find the actually 
error...

Second:
I dont trust Micro$ofts Apis. They are janky and have all sorts of traps in 
them...

What i would like to see is:
This Patch on a Japanese System with Russian Languange pack installed asking 
for Meiryo. If Podofo handles this case it should be good for every case...
(Doesnt have to be japanese and russian, but it should be 2 different languages 
which both have a non latin alphabet)

BUT, that said:
The api approach is less codelines and you need almost no knowledge about the 
ttc/ttf format to understand the code so thats a big plus!

Greetings,
Dennis





::DISCLAIMER::
----------------------------------------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended 
for the named recipient(s) only.
E-mail transmission is not guaranteed to be secure or error-free as information 
could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or may contain viruses in 
transmission. The e mail and its contents
(with or without referred errors) shall therefore not attach any liability on 
the originator or HCL or its affiliates.
Views or opinions, if any, presented in this email are solely those of the 
author and may not necessarily reflect the
views or opinions of HCL or its affiliates. Any form of reproduction, 
dissemination, copying, disclosure, modification,
distribution and / or publication of this message without the prior written 
consent of authorized representative of
HCL is strictly prohibited. If you have received this email in error please 
delete it and notify the sender immediately.
Before opening any email and/or attachments, please check them for viruses and 
other defects.

----------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to