This repository was archived by the owner on Jun 24, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
modules/javafx.graphics/src/main/native-font Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -673,11 +673,26 @@ JNIEXPORT jint JNICALL OS_NATIVE(CTRunGetPositions)
673673{
674674 CTRunRef run = (CTRunRef )runRef ;
675675 const CGPoint * positions = CTRunGetPositionsPtr (run );
676+ CFIndex count = CTRunGetGlyphCount (run );
677+ if (count == 0 ) {
678+ return 0 ;
679+ }
680+
681+ CGPoint * tempPositions = NULL ;
682+ if (!positions ) {
683+ tempPositions = (CGPoint * ) malloc (count * sizeof (CGPoint ));
684+ if (!tempPositions ) {
685+ return 0 ;
686+ }
687+
688+ CTRunGetPositions (run , CFRangeMake (0 , 0 ), tempPositions );
689+ positions = tempPositions ;
690+ }
691+
676692 int j = 0 ;
677693 if (positions ) {
678694 jfloat * buffer = (* env )-> GetPrimitiveArrayCritical (env , bufferRef , NULL );
679695 if (buffer ) {
680- CFIndex count = CTRunGetGlyphCount (run );
681696 int i = 0 ;
682697 while (i < count ) {
683698 CGPoint pos = positions [i ++ ];
@@ -687,6 +702,10 @@ JNIEXPORT jint JNICALL OS_NATIVE(CTRunGetPositions)
687702 (* env )-> ReleasePrimitiveArrayCritical (env , bufferRef , buffer , 0 );
688703 }
689704 }
705+
706+ if (tempPositions ) {
707+ free (tempPositions );
708+ }
690709 return j ;
691710}
692711
You can’t perform that action at this time.
0 commit comments