Issue 10843 - OOO_STABLE_1_PORTS/X11: Mac native .dfont recognition in psprint/vcl
Summary: OOO_STABLE_1_PORTS/X11: Mac native .dfont recognition in psprint/vcl
Status: CLOSED FIXED
Alias: None
Product: porting
Classification: Code
Component: code (show other issues)
Version: OOo 1.0.1
Hardware: Mac Mac OS X, all
: P3 Trivial (vote)
Target Milestone: OOo 1.0.4
Assignee: fa
QA Contact: issues@porting
URL:
Keywords: merge_pending
: 10803 (view as issue list)
Depends on:
Blocks: 10134
  Show dependency tree
 
Reported: 2003-01-22 05:24 UTC by fa
Modified: 2007-02-05 03:27 UTC (History)
3 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
cd to SRC_ROOT/psprint, patch -p0 < /path/to/patchfile Implements recognition of Mac native fonts for psprint. (26.82 KB, patch)
2003-01-22 07:41 UTC, fa
no flags Details | Diff
cd to SRC_ROOT/vcl, patch -p0 < /path/to/patchfile Allows Freetype (from Apple's X11) to recognize Mac native fonts discovered by psprint. Also adds Lucida Grande UI font support. (10.54 KB, patch)
2003-01-22 07:42 UTC, fa
no flags Details | Diff
cd to SRC_ROOT/tools, patch -p0 < /path/to/patchfile Adds sal locale discovery support to tools in GetSystemLanguage() (2.36 KB, patch)
2003-01-22 07:49 UTC, fa
no flags Details | Diff
cd to psprint, patch -p0 < /path/to/patchfile Allows psprint to read and print most Mac fonts, when converted wtih Fondu (8.07 KB, patch)
2003-03-17 23:05 UTC, fa
no flags Details | Diff
cd to vcl, patch -p0 < /path/to/patchfile Allows the vcl to recognize and display Mac fonts when converted with Fondu (17.59 KB, patch)
2003-03-17 23:06 UTC, fa
no flags Details | Diff
cd tools, patch -p0 < /path/to/patchfile REPLACES 012203 tools patch. (1.56 KB, patch)
2003-03-27 00:45 UTC, fa
no flags Details | Diff
revised vcl patch (13.26 KB, patch)
2003-03-27 11:16 UTC, philipp.lohmann
no flags Details | Diff
revised patch, Allows Mac OS X to now use XRenderCompositeString32() (19.01 KB, patch)
2003-03-27 17:31 UTC, fa
no flags Details | Diff
cd to vcl, patch -p0 < /path/to/patchfile REQUIRES the vcl.NATIVEFONT4.PORTS3 patch. corrects typecast error that broke compile (1.01 KB, patch)
2003-03-28 02:45 UTC, fa
no flags Details | Diff
another path revision (14.63 KB, patch)
2003-03-28 09:49 UTC, philipp.lohmann
no flags Details | Diff
cd to vcl, patch -p0 < /path/to/patchfile Corrects typecast from previous 032703 vcl.xrender patch (781 bytes, patch)
2003-03-28 13:50 UTC, fa
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description fa 2003-01-22 05:24:20 UTC
Patches implement preliminary .dfont support for Mac OS X.  Contributed
by Dan (psprint) and Ed (vcl).

Further fixups:

1)  Make sure encoding support is correct
2)  Treat .dfonts as TrueType Collections because they can
store multiple fonts in one file.
3)  Code cleanups
4)  Factor out Mac OS X specific code into a separate dylib so we work on Darwin too
Comment 1 fa 2003-01-22 07:41:14 UTC
Created attachment 4395 [details]
cd to SRC_ROOT/psprint, patch -p0 < /path/to/patchfile   Implements recognition of Mac native fonts for psprint.
Comment 2 fa 2003-01-22 07:42:24 UTC
Created attachment 4396 [details]
cd to SRC_ROOT/vcl, patch -p0 < /path/to/patchfile    Allows Freetype (from Apple's X11) to recognize Mac native fonts discovered by psprint.  Also adds Lucida Grande UI font support.
Comment 3 fa 2003-01-22 07:44:04 UTC
Note:

Both 012203 patch treats Mac TrueType dfonts as TrueType collections (ie more than one Font/face in a single file) and allows multiple faces to be used from the same file.

Further work:
1)  Encoding cleanups
2)  Code cleanups
3)  Factoring out to external dylib so we can run on pure Darwin

Dan
Comment 4 fa 2003-01-22 07:49:20 UTC
Created attachment 4397 [details]
cd to SRC_ROOT/tools, patch -p0 < /path/to/patchfile    Adds sal locale discovery support to tools in GetSystemLanguage()
Comment 5 philipp.lohmann 2003-01-22 10:10:05 UTC
Dan: In convertTrueTypeName you use osl_getThreadTextEncoding for all
mac encodings; this probably only works as long as you are working in
the correct locale. I think abetter way of doing this would be a
switch statement like e.g. this:

if ( pNameRecord->platformID == 1 )
{
rtl_TextEncoding aEnc;
switch( pNameRecord->encodingID )
{
default:
case 0: aEnc = RTL_TEXTENCODING_APPLE_ROMAN;break;
case 1: aEnc = RTL_TEXTENCODING_APPLE_JAPANESE;break;
case 2: aEnc = RTL_TEXTENCODING_APPLE_CHINTRAD;break;
case 3: aEnc = RTL_TEXTENCODING_APPLE_KOREAN;break;
...
}
aName.append( OStringToOUString( OString((sal_Char*)pNameBuffer,
pNameRecord->slen), aEnc ) );
}
else
...

judging from rtl/textenc.h we do not have all 31 *_APPLE_* encodings
documented in the OpenType documentation, but quite a lot are available.
Comment 6 fa 2003-01-22 14:43:08 UTC
Ok, will do.

dan
Comment 7 fa 2003-01-22 16:00:53 UTC
One question:

Should I use the Platform Specific Encoding ID for the name, or the Language ID?  The Apple documentation seems to indicated that the name in the 'name' table is encoded in the encoding specified in the Language ID, but there are a heck of a lot more of those than there are PSEIDs.

Which one?

Dan
Comment 8 philipp.lohmann 2003-01-22 16:21:43 UTC
I think the encoding id means the actual encoding of the name while
the lang id describes the language in for which the entry is intended;
e.g. Roman encoding contains all glyphs for Western languages (e.g.
English, German, French). So names for the US, Germany and France
would all have encoding id 0 but differ in language id. If you want to
support the language ID, you would have to modify
analyzeTrueTypeFamilyName which already does this according to the
currently used language for MS language ids; it would be more
difficult for the Apple IDs since one would have to map them; i think
for this preliminary version it is not worth the effort, these things
will be fixed with a genuine Aqua version.
Comment 9 fa 2003-03-12 03:47:48 UTC
Major change for native font support:  we are going to use Fondu to convert all the
Mac native fonts (at install time) to .ttf files, with _one_ face per file.  This corrects
a whole host of problems.  The problems with the fully-native, dynamic font patch
were:

1)  Ate lots of ram because cannot mmap() resource-based fonts, have to copy to mem
2)  Ate more ram because the copy to mem happens 3 times
3)  Have to modify Freetype to be aware of > 1 face per file
4)  have to modify both psprint and vcl to be aware of > 1 face per file

So, all of these problems will go away because we can, using Fondu, make sure that
all fonts have only 1 face per file.  Therefore we can use an unmodified Freetype,
keep all the original code in the vcl and psprint, and not have to worry about wierd
fonts in various places in the system folders.

Implementation on modified plan has started.

Dan
Comment 10 fa 2003-03-12 03:50:00 UTC
*** Issue 10803 has been marked as a duplicate of this issue. ***
Comment 11 fa 2003-03-17 23:05:39 UTC
Created attachment 5117 [details]
cd to psprint, patch -p0 < /path/to/patchfile   Allows psprint to read and print most Mac fonts, when converted wtih Fondu
Comment 12 fa 2003-03-17 23:06:22 UTC
Created attachment 5118 [details]
cd to vcl, patch -p0 < /path/to/patchfile   Allows the vcl to recognize and display Mac fonts when converted with Fondu
Comment 13 fa 2003-03-17 23:08:54 UTC
Native Fonts v4:
psprint.NATIVEFONT4.PORTS.diff
vcl.NATIVEFONT4.PORTS.diff

These patches require the fonts to be converted with Fondu and placed into the OOo fonts folder (share/fonts/truetype).  The implement minimal kerning for Mac fonts, and allow recognition of Unicode character maps in Mac fonts.

Other changes include antialiasing everything in the UI, as well as returning only the first font a device supports when getting its default font.

Please approve both patches for commit to OOO_STABLE_1_PORTS.
Comment 14 khendricks 2003-03-17 23:27:16 UTC
Hi Dan,  
  
I looked at both your NATIVEFONT4 diffs and they look good but I don't feel qualified to 
approve these.  
 
Perhaps Philipp can approve them.  
  
I did have one question:  
  
Why do you need the following:  
  
+inline sal_uInt32 getUInt32BE( const sal_uInt8*& pBuffer )  
+{  
+    sal_uInt32 nRet = (((sal_uInt32)pBuffer[0]) << 24) |  
+                      (((sal_uInt32)pBuffer[1]) << 16) |  
+                      (((sal_uInt32)pBuffer[2]) << 8)  |  
+                      (((sal_uInt32)pBuffer[3]) );  
+  
+    pBuffer += 4;  
+    return nRet;  
+}  
+  
  
Unless I am really confused here, the PowerPC processor is a BigEndian processor  
(although it can actually run in little endian mode also) it is used as BigEndian under  
Darwin, PPC Linux, AIX, PPC 64 Linux, etc.  
  
So the natural byte order for loading 4 btyes will be in the order your you are loading  
above (most-significant byte first - ala big endian) so I do not hink you would need the  
loads by bytes and shifts unless you were running this code on a little endian box.  
  
Now x86 is littleendian so I could forsee someone using this code from x86.  
  
Is the code that invokes this MacOSX specific or is it cross-platform?  
  
If MacOSX specific you should not need to write it that way for efficiency sake.  
If corss-platform, then yes this is the right way to force read a bigendian value on both  
big endian and little endian machines.  
  
Sorry I can' be more help but I think if we ask Philipp he can probably approve this easily.  
  
Kevin  
  
  
  
  
  
  
Comment 15 fa 2003-03-17 23:32:56 UTC
Kevin,

This could be used on x86 to use Mac TrueType fonts converted with Fondu.

dan
Comment 16 philipp.lohmann 2003-03-18 12:06:41 UTC
some comments:

in vcl/unx/source/gdi/gcach_xpeer.hxx you patch the following:

+#ifdef MACOSX
 	void	
(*pXRenderCompositeString16)(Display*,int,Picture,Picture,XRenderPictFormat*,GlyphSet,int,int,int,int,unsigned
short*,int);
+#else
+	void	
(*pXRenderCompositeString32)(Display*,int,Picture,Picture,XRenderPictFormat*,GlyphSet,int,int,int,int,unsigned*,int);
+#endif

why ? It breaks the build on other platforms. I checked against
OOO_STABLE_1_PORTS and there was no 32 version.


the changes in outdev3.cxx:GetDefaultFont: i'm not sure what you
intend to do here. I'm also quite sure it will have no negative effect
though.

The rest of the NATIVEFONT pathces seemed good to me. The tools patch
does not seem to be against OOO_STABLE_1_PORTS as it fails to apply.
Comment 17 fa 2003-03-18 14:39:34 UTC
pl,

I just checked, and there _are_ #ifdefs around the correct code in gcach_xpeer.cxx in 
PORTS, so this code should compile fine.  All other platforms will use 32 while Mac OS
X will use 16.  This change brings us up to 644 for gcach_xpeer.*.

For the GetDefaultFont(), we are attempting to return _only_ the first font that the
device supports, given a string of fonts separated by ";".  This code does that.  Before,
we'd get a long list of fonts rather than just one.  Also corrected what I thought was a
bug in the "pSearch3" thing there.

I will have to check out the tools patch.

Dan
Comment 18 fa 2003-03-27 00:45:40 UTC
Created attachment 5256 [details]
cd tools, patch -p0 < /path/to/patchfile  REPLACES 012203 tools patch.
Comment 19 fa 2003-03-27 00:49:50 UTC
Philipp,

Can you look over the patches again and approve for commit?

Thanks,
Dan
Comment 20 philipp.lohmann 2003-03-27 11:15:57 UTC
There is still the issue with the missing #ifdefs in salgdi3.cxx (for
pXRenderCompositeString32); i'll attach an alternative patch that does
this. By the way, why not use the *32 function on MacOS, too ? We
wouldn't need an #ifdef at all.

apart from this issue it looks good, approved
Comment 21 philipp.lohmann 2003-03-27 11:16:46 UTC
Created attachment 5266 [details]
revised vcl patch
Comment 22 fa 2003-03-27 17:31:36 UTC
Created attachment 5287 [details]
revised patch, Allows Mac OS X to now use XRenderCompositeString32()
Comment 23 fa 2003-03-27 17:33:33 UTC
Philipp,

Can you look over the vcl.NATIVEFONT4.PORTS3.diff patch?  I've now removed XRenderCompositeString16 from the Mac stuff to bring it in line with 644.

So, please approve for commit all these patches:
vcl.NATIVEFONT4.PORTS3.diff
tools.macfont.OOO_STABLE_1_PORTS.032603.patch
psprint.NATIVEFONT4.PORTS.diff

Dan
Comment 24 philipp.lohmann 2003-03-27 17:46:07 UTC
looks good, approved
Comment 25 fa 2003-03-27 18:41:52 UTC
Approved files committed to PORTS.

MERGE:
vcl.NATIVEFONT4.PORTS3.diff
tools.macfont.OOO_STABLE_1_PORTS.032603.patch
psprint.NATIVEFONT4.PORTS.diff

Dan
Comment 26 fa 2003-03-28 02:45:16 UTC
Created attachment 5299 [details]
cd to vcl, patch -p0 < /path/to/patchfile   REQUIRES the vcl.NATIVEFONT4.PORTS3 patch.  corrects typecast error that broke compile
Comment 27 fa 2003-03-28 02:46:27 UTC
vcl.xrender patch corrects a typecast error in salgdi3.cxx.  Please approve for commit
to PORTS.

Dan
Comment 28 philipp.lohmann 2003-03-28 09:49:04 UTC
I dif not find that one; in the PORTS2 patch i changed the signature
in gcach_xpeer.hxx so it uses sal_uInt32* instead of unsigned* since
sal_uInt32 is supposed to be a 32 bit integer on all platforms. But on
second thought this is actually wrong, since the render header
requirses unsigned int*, so instead of the cast really the pointer
type should be changed (i think they should have used CARD32, but
maybe that's just me). I'll attach a revised patch.
Comment 29 philipp.lohmann 2003-03-28 09:49:57 UTC
Created attachment 5308 [details]
another path revision
Comment 30 fa 2003-03-28 13:50:59 UTC
Created attachment 5320 [details]
cd to vcl, patch -p0 < /path/to/patchfile   Corrects typecast from previous 032703 vcl.xrender patch
Comment 31 fa 2003-03-28 13:51:46 UTC
Philipp,

Can you approve the vcl.xrender.032803.patch for commit to PORTS?

Thanks,
Dan
Comment 32 philipp.lohmann 2003-03-28 14:02:31 UTC
looks good. approved
Comment 33 fa 2003-03-28 14:52:05 UTC
vcl.xrender.032803.patch committed to PORTS.

MERGE:
--------------------------------------------
vcl.NATIVEFONT4.PORTS3.diff
tools.macfont.OOO_STABLE_1_PORTS.032603.patch
psprint.NATIVEFONT4.PORTS.diff
vcl.xrender.032803.patch
Comment 34 philipp.lohmann 2003-03-28 15:24:09 UTC
A long story finally comes to a happy end ... :-)
Comment 35 fa 2003-08-04 05:38:01 UTC
Fixed in 103 GM.  Never gonna get full native .dfont support until Aqua.
Comment 36 jjmckenzie 2007-02-05 03:26:42 UTC
Sad story, but dfont support will not exist until Aqua port is finished.  

James McKenzie
Comment 37 jjmckenzie 2007-02-05 03:27:45 UTC
Closing issue.

James McKenzie