From e384e627d1c6fb47061d278c10920a980a583f39 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 25 Apr 2026 21:42:21 -0300 Subject: [PATCH] PPTX icon resolver: prefer full icon group over text-strip variant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OCI_Icons.pptx ships both a full icon group (tag=grpSp, ~0.7" tall) and a tiny "label strip" (tag=sp, ~0.2" tall) under the same slug for many services. The previous resolver picked whichever came first in the index, which for 'mysql' returned the text strip — so the PPTX diagram showed a label-only shape instead of the dolphin/HeatWave icon, while drawio rendered the proper stencil. Two fixes, both persistent (apply to every icon family, not just MySQL): - TYPE_TO_ICON for mysql/heatwave now lists 'mysql_heatwave' (the grpSp) before 'mysql' (the strip). - _select_preferred_ref now filters viable refs to those that are either grpSp/pic OR have a bbox ≥0.4"x0.4" — text strips fall out before the scoring function runs. Co-Authored-By: Claude Opus 4.7 (1M context) --- tools/oci_pptx_diagram_gen.py | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/tools/oci_pptx_diagram_gen.py b/tools/oci_pptx_diagram_gen.py index c99d68d..42a8522 100644 --- a/tools/oci_pptx_diagram_gen.py +++ b/tools/oci_pptx_diagram_gen.py @@ -129,10 +129,10 @@ TYPE_TO_ICON = { "logging": ["logging"], "logging_analytics": ["logging_analytics"], "tag_namespace": ["tag_namespace"], - "mysql": ["mysql", "database_mysql"], - "mysql_heatwave": ["mysql", "database_mysql"], - "heatwave": ["mysql", "database_mysql"], - "mysql_database_service": ["mysql", "database_mysql"], + "mysql": ["mysql_heatwave", "mysql_database_system", "mysql"], + "mysql_heatwave": ["mysql_heatwave", "mysql_database_system", "mysql"], + "heatwave": ["mysql_heatwave", "mysql_database_system", "mysql"], + "mysql_database_service": ["mysql_heatwave", "mysql_database_system", "mysql"], } ICON_KEYWORD_HINTS = { @@ -187,9 +187,9 @@ ICON_KEYWORD_HINTS = { "oke": ["oci_container_engine_for_kubernetes", "container_engine_for_kubernetes_cluster"], "kubernetes": ["oci_container_engine_for_kubernetes", "container_engine_for_kubernetes_cluster"], "mysql": ["mysql", "database_mysql"], - "mysql heatwave": ["mysql", "database_mysql"], - "heatwave": ["mysql", "database_mysql"], - "mysql database service": ["mysql", "database_mysql"], + "mysql heatwave": ["mysql_heatwave", "mysql_database_system", "mysql"], + "heatwave": ["mysql_heatwave", "mysql_database_system", "mysql"], + "mysql database service": ["mysql_heatwave", "mysql_database_system", "mysql"], } @@ -913,6 +913,22 @@ class NativePPTXDiagramRenderer: if not viable: return refs[0] if refs else None + # OCI_Icons.pptx ships both a full icon group (tag=grpSp, ~0.7" + # tall) and a tiny "label strip" (tag=sp, ~0.2" tall) under the + # same slug for many services. The strip renders as just a text + # label which makes the diagram look broken next to the drawio + # version. Prefer the icon group whenever one exists. + icon_shaped = [ + ref for ref in viable + if ref.get("tag") in {"grpSp", "pic"} + or ( + int((ref.get("bbox") or {}).get("cy", 0)) >= _emu(0.4) + and int((ref.get("bbox") or {}).get("cx", 0)) >= _emu(0.4) + ) + ] + if icon_shaped: + viable = icon_shaped + preferred_slide_order = { 29: 0, 30: 1,