Aspose.Slides for Java 15.1.0의 공개 API 및 이전 버전과 호환되지 않는 변경 사항

공용 API 변경 사항

글꼴 대체 기능이 추가되었습니다

프레젠테이션 전체에서 글꼴을 전역적으로 교체하거나 렌더링 시 일시적으로 교체할 수 있는 기능이 추가되었습니다.

Presentation 클래스에 새로운 메서드 getFontsManager() 가 도입되었습니다. FontsManager 클래스는 다음 멤버를 제공합니다:

IFontSubstRuleCollection getFontSubstRuleList() 메서드

이 메서드는 렌더링 중에 글꼴을 대체하는 데 사용되는 IFontSubstRule 인스턴스의 컬렉션을 반환합니다. IFontSubstRule은 IFontData 인터페이스를 구현하는 getSourceFont()getDestFont() 메서드와, 교체 조건(“WhenInaccessible” 또는 “Always”)을 선택할 수 있게 해주는 getReplaceFontCondition() 메서드를 제공합니다.

IFontData[] getFonts() 메서드를 사용하면 현재 프레젠테이션에 사용된 모든 글꼴을 검색할 수 있습니다.

replaceFont(…) 메서드를 사용하면 프레젠테이션 내에서 글꼴을 영구적으로 교체할 수 있습니다.

다음 예제는 프레젠테이션에서 글꼴을 교체하는 방법을 보여줍니다:


 Presentation pres = new Presentation("PresContainsArialFont.pptx");

IFontData sourceFont = new FontData("Arial");

IFontData destFont = new FontData("Times New Roman");

pres.getFontsManager().replaceFont(sourceFont, destFont);

pres.save("PresContainsTimesNoewRomanFont.pptx", SaveFormat.Pptx);

또 다른 예제는 글꼴이 접근 불가능할 때 렌더링을 위한 글꼴 대체를 보여줍니다:




Presentation pres = new Presentation("PresContainsSomeRareFontFont.pptx");

IFontData sourceFont = new FontData("SomeRareFont");

IFontData destFont = new FontData("Arial");

IFontSubstRule fontSubstRule = new FontSubstRule(

sourceFont, destFont, FontSubstCondition.WhenInaccessible);

IFontSubstRuleCollection fontSubstRuleCollection = new FontSubstRuleCollection();

fontSubstRuleCollection.add(fontSubstRule);

pres.getFontsManager().setFontSubstRuleList(fontSubstRuleCollection);

// Arial 글꼴은 SomeRareFont에 접근할 수 없을 때 대신 사용됩니다.

pres.getSlides().get_Item(0).getThumbnail(1, 1);