diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/GMFHelper.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/GMFHelper.java index f94b4723ca..b49ae8d82a 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/GMFHelper.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/GMFHelper.java @@ -45,12 +45,14 @@ import org.eclipse.gmf.runtime.notation.Bounds; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.Edge; +import org.eclipse.gmf.runtime.notation.FontStyle; import org.eclipse.gmf.runtime.notation.LayoutConstraint; import org.eclipse.gmf.runtime.notation.Location; import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.gmf.runtime.notation.RelativeBendpoints; import org.eclipse.gmf.runtime.notation.Size; +import org.eclipse.gmf.runtime.notation.Style; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint; import org.eclipse.jface.resource.ImageDescriptor; @@ -1086,7 +1088,16 @@ public static Dimension getLabelDimension(Node node, Dimension defaultDimension) if (!new DDiagramElementQuery(dDiagramElement).isLabelHidden()) { if (siriusStyle instanceof BasicLabelStyle) { BasicLabelStyle bls = (BasicLabelStyle) siriusStyle; - Font defaultFont = VisualBindingManager.getDefault().getFontFromLabelStyle(bls, (String) viewQuery.getDefaultValue(NotationPackage.Literals.FONT_STYLE__FONT_NAME)); + String fontName = (String) viewQuery.getDefaultValue(NotationPackage.Literals.FONT_STYLE__FONT_NAME); + Style style = node.getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style instanceof FontStyle) { + String currentFontName = ((FontStyle) style).getFontName(); + if (currentFontName != null && !currentFontName.isEmpty()) { + // Use the defined font name in the node if it is defined. + fontName = currentFontName; + } + } + Font defaultFont = VisualBindingManager.getDefault().getFontFromLabelStyle(bls, fontName); try { labelSize = FigureUtilities.getStringExtents(dDiagramElement.getName(), defaultFont); if (bls.isShowIcon()) {