Skip to content

Commit d3dd33a

Browse files
committed
Initial project scaffold: solution, CI/CD, design docs, and phase plans
1 parent b1e7723 commit d3dd33a

29 files changed

Lines changed: 2155 additions & 0 deletions

.codacy.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
exclude_paths:
2+
- "**/bin/**"
3+
- "**/obj/**"

.editorconfig

Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
# editorconfig.org
2+
root = true
3+
4+
# All files
5+
[*]
6+
indent_style = tab
7+
indent_size = 4
8+
tab_width = 4
9+
end_of_line = crlf
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true
13+
14+
# XML files
15+
[*.{xml,csproj,props,targets,slnx}]
16+
indent_style = tab
17+
indent_size = 4
18+
tab_width = 4
19+
20+
# JSON files
21+
[*.json]
22+
indent_style = tab
23+
indent_size = 4
24+
tab_width = 4
25+
26+
# YAML files
27+
[*.{yml,yaml}]
28+
indent_style = space
29+
indent_size = 2
30+
31+
# Markdown files
32+
[*.md]
33+
trim_trailing_whitespace = false
34+
35+
# C# files
36+
[*.cs]
37+
38+
#### .NET Coding Conventions ####
39+
40+
# Organize usings
41+
dotnet_sort_system_directives_first = true
42+
dotnet_separate_import_directive_groups = false
43+
44+
# this. preferences
45+
dotnet_style_qualification_for_event = false:warning
46+
dotnet_style_qualification_for_field = false:warning
47+
dotnet_style_qualification_for_method = false:warning
48+
dotnet_style_qualification_for_property = false:warning
49+
50+
# Language keywords vs BCL types
51+
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
52+
dotnet_style_predefined_type_for_member_access = true:warning
53+
54+
# Parentheses
55+
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
56+
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
57+
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
58+
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
59+
60+
# Modifier preferences
61+
dotnet_style_require_accessibility_modifiers = for_non_interface_members:error
62+
63+
# Expression-level preferences
64+
dotnet_style_coalesce_expression = true:warning
65+
dotnet_style_collection_initializer = true:warning
66+
dotnet_style_explicit_tuple_names = true:warning
67+
dotnet_style_null_propagation = true:warning
68+
dotnet_style_object_initializer = true:warning
69+
dotnet_style_prefer_auto_properties = true:warning
70+
dotnet_style_prefer_compound_assignment = true:warning
71+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
72+
dotnet_style_prefer_conditional_expression_over_return = true:silent
73+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
74+
dotnet_style_prefer_inferred_tuple_names = true:warning
75+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
76+
dotnet_style_prefer_simplified_boolean_expressions = true:warning
77+
dotnet_style_prefer_simplified_interpolation = true:warning
78+
dotnet_style_readonly_field = true:warning
79+
80+
# Parameter preferences
81+
dotnet_code_quality_unused_parameters = all:warning
82+
83+
#### C# Coding Conventions ####
84+
85+
# var preferences
86+
csharp_style_var_elsewhere = false:silent
87+
csharp_style_var_for_built_in_types = false:silent
88+
csharp_style_var_when_type_is_apparent = true:silent
89+
90+
# Expression-bodied members
91+
csharp_style_expression_bodied_accessors = true:warning
92+
csharp_style_expression_bodied_constructors = false:silent
93+
csharp_style_expression_bodied_indexers = true:warning
94+
csharp_style_expression_bodied_lambdas = true:warning
95+
csharp_style_expression_bodied_local_functions = false:silent
96+
csharp_style_expression_bodied_methods = when_on_single_line:silent
97+
csharp_style_expression_bodied_operators = when_on_single_line:silent
98+
csharp_style_expression_bodied_properties = true:warning
99+
100+
# Pattern matching
101+
csharp_style_pattern_matching_over_as_with_null_check = true:warning
102+
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
103+
csharp_style_prefer_not_pattern = true:warning
104+
csharp_style_prefer_pattern_matching = true:warning
105+
csharp_style_prefer_switch_expression = true:warning
106+
107+
# Null-checking
108+
csharp_style_conditional_delegate_call = true:warning
109+
csharp_style_prefer_null_check_over_type_check = true:warning
110+
111+
# Modifier preferences
112+
csharp_prefer_static_local_function = true:warning
113+
csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:warning
114+
115+
# Code block preferences
116+
csharp_prefer_braces = true:warning
117+
csharp_prefer_simple_using_statement = true:warning
118+
119+
# Expression-level preferences
120+
csharp_prefer_simple_default_expression = true:warning
121+
csharp_style_deconstructed_variable_declaration = true:warning
122+
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
123+
csharp_style_inlined_variable_declaration = true:warning
124+
csharp_style_prefer_index_operator = true:warning
125+
csharp_style_prefer_range_operator = true:warning
126+
csharp_style_throw_expression = true:warning
127+
csharp_style_unused_value_assignment_preference = discard_variable:warning
128+
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
129+
csharp_style_prefer_local_over_anonymous_function = true:warning
130+
csharp_style_prefer_method_group_conversion = true:warning
131+
csharp_style_prefer_extended_property_pattern = true:warning
132+
csharp_style_prefer_top_level_statements = true:silent
133+
134+
# Operator wrapping
135+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
136+
137+
# using directive placement
138+
csharp_using_directive_placement = outside_namespace:warning
139+
140+
# Namespace preferences
141+
csharp_style_namespace_declarations = file_scoped:error
142+
143+
#### C# Formatting Rules ####
144+
145+
# New line preferences
146+
csharp_new_line_before_catch = true
147+
csharp_new_line_before_else = true
148+
csharp_new_line_before_finally = true
149+
csharp_new_line_before_members_in_anonymous_types = true
150+
csharp_new_line_before_members_in_object_initializers = true
151+
csharp_new_line_before_open_brace = all
152+
csharp_new_line_between_query_expression_clauses = true
153+
154+
# Indentation
155+
csharp_indent_block_contents = true
156+
csharp_indent_braces = false
157+
csharp_indent_case_contents = true
158+
csharp_indent_case_contents_when_block = true
159+
csharp_indent_labels = one_less_than_current
160+
csharp_indent_switch_labels = true
161+
162+
# Space preferences
163+
csharp_space_after_cast = false
164+
csharp_space_after_colon_in_inheritance_clause = true
165+
csharp_space_after_comma = true
166+
csharp_space_after_dot = false
167+
csharp_space_after_keywords_in_control_flow_statements = true
168+
csharp_space_after_semicolon_in_for_statement = true
169+
csharp_space_around_binary_operators = before_and_after
170+
csharp_space_around_declaration_statements = false
171+
csharp_space_before_colon_in_inheritance_clause = true
172+
csharp_space_before_comma = false
173+
csharp_space_before_dot = false
174+
csharp_space_before_open_square_brackets = false
175+
csharp_space_before_semicolon_in_for_statement = false
176+
csharp_space_between_empty_square_brackets = false
177+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
178+
csharp_space_between_method_call_name_and_opening_parenthesis = false
179+
csharp_space_between_method_call_parameter_list_parentheses = false
180+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
181+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
182+
csharp_space_between_method_declaration_parameter_list_parentheses = false
183+
csharp_space_between_parentheses = false
184+
csharp_space_between_square_brackets = false
185+
186+
# Wrapping preferences
187+
csharp_preserve_single_line_blocks = true
188+
csharp_preserve_single_line_statements = true
189+
190+
#### Naming styles ####
191+
192+
# Naming rules
193+
194+
dotnet_naming_rule.interface_should_be_begins_with_i.severity = error
195+
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
196+
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
197+
198+
dotnet_naming_rule.types_should_be_pascal_case.severity = error
199+
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
200+
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
201+
202+
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = error
203+
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
204+
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
205+
206+
dotnet_naming_rule.private_or_internal_field_should_be_begins_with_underscore.severity = warning
207+
dotnet_naming_rule.private_or_internal_field_should_be_begins_with_underscore.symbols = private_or_internal_field
208+
dotnet_naming_rule.private_or_internal_field_should_be_begins_with_underscore.style = begins_with_underscore
209+
210+
# Symbol specifications
211+
212+
dotnet_naming_symbols.interface.applicable_kinds = interface
213+
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
214+
215+
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
216+
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
217+
218+
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
219+
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
220+
221+
dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
222+
dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected
223+
224+
# Naming styles
225+
226+
dotnet_naming_style.pascal_case.capitalization = pascal_case
227+
228+
dotnet_naming_style.begins_with_i.required_prefix = I
229+
dotnet_naming_style.begins_with_i.capitalization = pascal_case
230+
231+
dotnet_naming_style.begins_with_underscore.required_prefix = _
232+
dotnet_naming_style.begins_with_underscore.capitalization = camel_case
233+
234+
#### Analyzers ####
235+
236+
# CA1062: Validate arguments of public methods
237+
dotnet_diagnostic.CA1062.severity = none
238+
239+
# CA1303: Do not pass literals as localized parameters
240+
dotnet_diagnostic.CA1303.severity = none
241+
242+
# CA1812: Avoid uninstantiated internal classes (false positives with DI)
243+
dotnet_diagnostic.CA1812.severity = none
244+
245+
# CA2007: Consider calling ConfigureAwait on the awaited task
246+
dotnet_diagnostic.CA2007.severity = warning
247+
248+
# IDE0058: Expression value is never used
249+
dotnet_diagnostic.IDE0058.severity = none

.github/copilot-instructions.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Copilot Instructions for PanoramicData.Render
2+
3+
## Project Overview
4+
5+
PanoramicData.Render is a high-fidelity rendering engine that converts OpenXML (DOCX) documents to paginated SVG and PDF output. It acts as a virtual layout engine — calculating exact glyph positions, line breaks, and object anchors — rather than a semantic HTML converter.
6+
7+
**Primary use case:** DOCX → SVG conversion for web-based document viewing.
8+
9+
## Architecture
10+
11+
The library follows a **Measure-then-Paint** pipeline:
12+
13+
1. **DOM Ingestion** — Open-XML-SDK loads DOCX parts
14+
2. **Style Resolution** — Full OOXML cascade (doc defaults → theme → numbering → table → paragraph/character style chains → toggle properties → direct formatting)
15+
3. **Layout Engine** — SkiaSharp + HarfBuzz for font metrics; Knuth-Plass line breaking; pagination
16+
4. **Render Abstraction**`IRenderTarget` interface for drawing commands
17+
5. **Output Drivers**`SvgRenderTarget` and `PdfRenderTarget`
18+
19+
## Key Technical Decisions
20+
21+
- **Internal unit:** Twips (1/1440 inch) — matches Word's internal precision
22+
- **Line breaking:** Knuth-Plass algorithm (paragraph-optimal, not greedy)
23+
- **Font measurement:** SkiaSharp with HarfBuzz (`SKShaper`) for complex script shaping
24+
- **PDF backend:** SkiaSharp `SKDocument.CreatePdf()` (known limitations: no tagged PDF, no font subsetting, no PDF/A)
25+
- **SVG fonts:** Optional WOFF2 embedding via `@font-face`
26+
- **Style cascade:** Full OOXML cascade including toggle property semantics (bold on bold = bold OFF)
27+
28+
## Coding Standards
29+
30+
This project follows the PanoramicData NugetManagement standards:
31+
32+
- **Target:** .NET 10.0
33+
- **Nullable:** Enabled, treat warnings as errors
34+
- **Namespaces:** File-scoped (`file namespace Foo;`) — enforced as ERROR
35+
- **Indentation:** Tabs, size 4
36+
- **Naming:**
37+
- Interfaces: `I` prefix (e.g., `IRenderTarget`)
38+
- Private fields: `_camelCase`
39+
- Everything else: `PascalCase`
40+
- **Accessibility modifiers:** Required on all non-interface members (ERROR)
41+
- **XML documentation:** Required on all public members
42+
- **JSON:** Use `System.Text.Json`, never `Newtonsoft.Json`
43+
- **Logging:** `Microsoft.Extensions.Logging.Abstractions` — no `Console.Write` or `Trace`
44+
- **Testing:** xUnit v3 + AwesomeAssertions
45+
- **Package management:** Central (`Directory.Packages.props`) — never inline version numbers in .csproj
46+
47+
## Project Structure
48+
49+
```
50+
PanoramicData.Render/ # Main library (NuGet package)
51+
PanoramicData.Render.Test/ # Test project (xUnit v3)
52+
docs/plans/ # Phased implementation plans
53+
```
54+
55+
## What NOT to Do
56+
57+
- Do not use greedy line breaking. The project uses Knuth-Plass.
58+
- Do not use HTML as an intermediate format. Output is SVG and PDF only.
59+
- Do not add `.doc` (binary Word format) support. DOCX only.
60+
- Do not add Newtonsoft.Json.
61+
- Do not suppress warnings without justification.
62+
- Do not use string concatenation for SVG building — use `StringBuilder` or XML APIs.
63+
- Do not hold all images in memory simultaneously — stream where possible.
64+
- Do not skip the style cascade. Every text run's formatting must be resolved through the full cascade.
65+
66+
## Non-Functional Requirements
67+
68+
- **Performance:** < 500ms for 1 page, < 10s for 50 pages, < 120s for 500 pages
69+
- **Memory:** Peak < 3× DOCX file size for text-heavy documents
70+
- **Thread safety:** `DocxRenderer` must be safe for concurrent use
71+
- **Error tolerance:** Malformed input → best-effort rendering + warnings, not exceptions
72+
- **Cancellation:** `CancellationToken` throughout the pipeline
73+
74+
## Key Documents
75+
76+
- `DESIGN.md` — Full architecture and technical design
77+
- `PLAN.md` — Phased implementation roadmap
78+
- `docs/plans/phase-*.md` — Detailed per-phase deliverables with hierarchical step numbering
79+
80+
## Dependencies
81+
82+
| Package | Purpose |
83+
|---|---|
84+
| `DocumentFormat.OpenXml` | OOXML parsing |
85+
| `SkiaSharp` | Font metrics, image processing, PDF backend |
86+
| `SkiaSharp.HarfBuzz` | Complex script shaping |
87+
| `Microsoft.Extensions.Logging.Abstractions` | Structured logging |
88+
89+
All dependencies are MIT-licensed.

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: nuget
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 10
8+
9+
- package-ecosystem: github-actions
10+
directory: /
11+
schedule:
12+
interval: weekly
13+
open-pull-requests-limit: 5

0 commit comments

Comments
 (0)