Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/BlazorUI/Bit.BlazorUI.Assets/Bit.BlazorUI.Assets.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
</ItemGroup>

<ItemGroup>
<Watch Remove="*.scss" />
<!-- dotnet watch: watch the scss sources so edits trigger the sass target on rebuilds. Rooted with
$(MSBuildProjectDirectory) because dotnet watch resolves relative Watch items of referenced
projects against the startup project's directory. -->
<Watch Include="$(MSBuildProjectDirectory)\**\*.scss" Exclude="$(MSBuildProjectDirectory)\node_modules\**;$(MSBuildProjectDirectory)\bin\**;$(MSBuildProjectDirectory)\obj\**" />
<ScssFiles Include="**\*.scss" />
</ItemGroup>

Expand Down
8 changes: 7 additions & 1 deletion src/BlazorUI/Bit.BlazorUI.Extras/Bit.BlazorUI.Extras.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@
<ItemGroup>
<Content Remove="compilerconfig.json" />
<None Include="compilerconfig.json" />
<Watch Remove="*.scss" />
<!-- dotnet watch: watch the scss/ts sources so edits trigger the sass/tsc targets on rebuilds.
The generated wwwroot css/js stay watched (default Content behavior) so dotnet watch can
hot-apply them when the demo server's ScssCompilerService regenerates them. Paths are rooted
with $(MSBuildProjectDirectory) because dotnet watch resolves relative Watch items of
referenced projects against the startup project's directory. -->
<Watch Include="$(MSBuildProjectDirectory)\**\*.scss" Exclude="$(MSBuildProjectDirectory)\node_modules\**;$(MSBuildProjectDirectory)\bin\**;$(MSBuildProjectDirectory)\obj\**" />
<Watch Include="$(MSBuildProjectDirectory)\**\*.ts" Exclude="$(MSBuildProjectDirectory)\node_modules\**;$(MSBuildProjectDirectory)\bin\**;$(MSBuildProjectDirectory)\obj\**;$(MSBuildProjectDirectory)\**\*.d.ts" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public enum BitPdfRenderMode
/// a display list produced by the C# engine (the pdf.js model). Far fewer DOM
/// nodes; selection, search and links still work through the DOM text layer,
/// and zoom changes re-rasterize the canvases so text stays crisp. Requires
/// JavaScript a prerendered page shows a blank canvas until the client
/// JavaScript - a prerendered page shows a blank canvas until the client
/// loads.
/// </summary>
Canvas,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public partial class BitPdfViewer : BitComponentBase

/// <summary>
/// How painted text is emitted. <see cref="BitPdfTextCoalescing.Compact"/> merges
/// same-line, same-style runs into one span per visual line far fewer DOM
/// same-line, same-style runs into one span per visual line - far fewer DOM
/// nodes on per-glyph PDFs, with small intra-line position drift (explicit
/// kerning between runs is approximated). Rotated text always stays exact.
/// Default is <see cref="BitPdfTextCoalescing.Exact"/>.
Expand Down Expand Up @@ -370,7 +370,7 @@ public void EnsureThumbsRendered(int[] pageNumbers)
if (changed)
{
// Evict around the range just requested (what is visible in the
// sidebar), not the current page scrolling the sidebar leaves the
// sidebar), not the current page - scrolling the sidebar leaves the
// current page put, so centering on it would blank the very
// thumbnails the user just scrolled to.
EvictDistantThumbs(lo, hi);
Expand Down Expand Up @@ -784,7 +784,7 @@ private void EvictDistantPages()
private MarkupString RenderThumbContent(int index)
{
// Canvas mode: page fragments are canvas placeholders whose pixels are
// painted by JS into the MAIN surface only a reused fragment would show
// painted by JS into the MAIN surface only - a reused fragment would show
// a blank thumbnail. Render sidebar thumbnails as self-contained HTML
// (Compact text keeps the tiny fragments light).
if (RenderMode == BitPdfRenderMode.Canvas)
Expand Down Expand Up @@ -1002,7 +1002,7 @@ private async Task RunSearchAsync()

// Search a per-page extracted-text index (built lazily) rather than the
// rendered DOM, so we only render the pages that actually contain matches
// a 500-page document with matches on 3 pages renders 3, not 500.
// - a 500-page document with matches on 3 pages renders 3, not 500.
_pageText ??= new string?[_document.PageCount];
string needle = _searchQuery;
bool rendered = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@
pointer-events: auto;
}

/* Selection spans (data-bit-pdv-sel) hold the real Unicode but paint nothing keep
/* Selection spans (data-bit-pdv-sel) hold the real Unicode but paint nothing - keep
them transparent even while selected so only the highlight box shows and the
painted glyphs beneath stay visible through it. Without this the browser paints
the selected substitute glyphs opaque, stacking a wrong-font copy over the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace BitBlazorUI {
}
}

// Scrolls `target` into view by scrolling ONLY `container` unlike
// Scrolls `target` into view by scrolling ONLY `container` - unlike
// scrollIntoView, which also scrolls every scrollable ancestor (including
// the hosting page, yanking the whole document around when the viewer is
// embedded mid-page).
Expand Down Expand Up @@ -393,7 +393,7 @@ namespace BitBlazorUI {
clone.style.transformOrigin = "top left";
// A cloned <canvas> loses its pixels: substitute a snapshot image so
// canvas-mode pages print their painted content. Pages with a cached
// display list re-rasterize at print resolution the screen-resolution
// display list re-rasterize at print resolution - the screen-resolution
// bitmap is sized for on-screen zoom and prints blurry.
const srcCanvases = el.querySelectorAll("canvas[data-bit-pdv-canvas]");
const dstCanvases = clone.querySelectorAll("canvas[data-bit-pdv-canvas]");
Expand Down Expand Up @@ -540,7 +540,7 @@ namespace BitBlazorUI {
return;
}

// @font-face faces load lazily only when DOM text uses them and canvas
// @font-face faces load lazily - only when DOM text uses them - and canvas
// fillText never waits for (or reliably triggers) a load: it draws with the
// fallback immediately. In canvas mode no DOM references the embedded
// families, so without an explicit load the FIRST paint renders tofu until
Expand Down Expand Up @@ -752,7 +752,7 @@ namespace BitBlazorUI {
const ranges: Range[] = [];

container.querySelectorAll("[data-page]").forEach((page) => {
// Search only the coalesced selection layer ([data-bit-pdv-sel]) it
// Search only the coalesced selection layer ([data-bit-pdv-sel]) - it
// holds the real Unicode in reading order. The painted layer beneath is
// presentational (real glyphs or Private-Use codepoints) and would
// otherwise double-count.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ private void Traverse(BitPdfDict node, InheritedAttributes inherited,
}

// A node explicitly typed /Pages but with no usable /Kids is a damaged
// interior node skip it rather than materializing a phantom page.
// interior node - skip it rather than materializing a phantom page.
if (BitPdfPrimitives.IsName(typeObj, "Pages"))
{
_xref.Warnings.Add("Interior /Pages node has no valid /Kids; skipping.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private static List<BitPdfStructElement> ReadKids(IBitPdfXRef xref, object? kids

private static void AddNode(IBitPdfXRef xref, object? item, List<BitPdfStructElement> result, HashSet<int> visited, int depth)
{
// Marked-content leaves are plain integers or MCR/OBJR dicts; skip them
// Marked-content leaves are plain integers or MCR/OBJR dicts; skip them -
// the structure tree API exposes the element hierarchy, not content refs.
if (item is double)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace Bit.BlazorUI;

/// <summary>
/// Thrown when a document declares an <c>/Encrypt</c> dictionary that this
/// library cannot handle an unsupported security handler or revision, or a
/// library cannot handle - an unsupported security handler or revision, or a
/// cryptographic primitive that is unavailable on the current platform (for
/// example MD5/AES in the browser WebAssembly sandbox). Distinct from
/// <see cref="BitPdfFormatException"/> so callers can surface a clear "this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void Parse()
}

// If the classic/stream path did not yield a usable catalog, brute-force
// scan the file for objects and rebuild matching pdf.js recovery.
// scan the file for objects and rebuild - matching pdf.js recovery.
if (Trailer is null || Root is null)
{
RebuildByScanning();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Bit.BlazorUI;
/// <summary>
/// Extracts the visible text of a page by replaying its content stream and
/// decoding show-text operators through each selected font. Positioning is
/// approximated with simple space/newline heuristics enough for search and
/// approximated with simple space/newline heuristics - enough for search and
/// copy, not a layout-faithful reconstruction.
/// </summary>
public static class BitPdfTextExtractor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private sealed class HuffTable
switch (marker)
{
case 0xC0: // SOF0 baseline
case 0xC1: // SOF1 extended sequential (Huffman) same layout
case 0xC1: // SOF1 extended sequential (Huffman) - same layout
{
precision = data[segStart];
frameHeight = (data[segStart + 1] << 8) | data[segStart + 2];
Expand All @@ -120,7 +120,7 @@ private sealed class HuffTable
}
break;
}
case 0xC2: // SOF2 progressive not supported here
case 0xC2: // SOF2 progressive - not supported here
return null;
case 0xC4: // DHT
ReadHuffmanTables(data, segStart, segEnd, huffDc, huffAc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal sealed class BitPdfCffFontParser
/// <summary>The raw CFF Encoding offset from the Top DICT (0/1 = predefined).</summary>
public int EncodingOffset { get; private set; }

/// <summary><c>true</c> for a CID-keyed CFF (ROS present) unsupported here.</summary>
/// <summary><c>true</c> for a CID-keyed CFF (ROS present) - unsupported here.</summary>
public bool IsCid { get; private set; }

public static BitPdfCffFontParser? Parse(byte[] cff)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ private static (byte[]?, string?) ExtractEmbedded(BitPdfDict? descriptor)
: (data, "cff");
}
// Type1 program (/FontFile): parse it and build an OpenType/CFF font the
// browser can load. On any failure fall through to a substitute font
// browser can load. On any failure fall through to a substitute font -
// a rejected @font-face simply falls back to the generic family.
if (descriptor.Get("FontFile") is BitPdfStream t1Stream)
{
Expand Down Expand Up @@ -723,7 +723,7 @@ private double WidthFor(int code)
int index = code - _firstChar;
if (index >= 0 && index < _widths.Length)
{
// An explicit width of 0 is valid (e.g. combining marks) use it
// An explicit width of 0 is valid (e.g. combining marks) - use it
// rather than falling through to a substitute metric.
return _widths[index] * _glyphWidthScale;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ internal static class BitPdfSfntGlyphMapper
var names = ReadPost(font, dir); // glyph name → gid

// Map each byte code to a unique Private-Use-Area codepoint (glyph
// painting is by exact glyph id no shaping, no Unicode collisions).
// painting is by exact glyph id - no shaping, no Unicode collisions).
var result = new Dictionary<int, int>();
for (int code = 0; code < 256; code++)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// A conservative TrueType/OpenType (sfnt) sanitizer. Embedded PDF subset fonts
// frequently ship with an unsorted table directory, wrong table checksums, a
// wrong head.checkSumAdjustment, or unpadded tables all of which strict font
// wrong head.checkSumAdjustment, or unpadded tables - all of which strict font
// parsers (including the browser's OTS) reject, so the @font-face silently fails
// to load. This rebuilds a structurally valid sfnt: recognized tables are kept
// verbatim, the directory is re-sorted, tables are 4-byte aligned, and all
Expand All @@ -21,7 +21,7 @@ internal static class BitPdfTrueTypeSanitizer

/// <summary>
/// As <see cref="Sanitize(byte[])"/>, but replaces the font's <c>cmap</c> with
/// <paramref name="replacementCmap"/> when supplied used to inject a clean
/// <paramref name="replacementCmap"/> when supplied - used to inject a clean
/// synthetic Unicode cmap for subset fonts whose own cmap OTS rejects.
/// </summary>
public static byte[]? Sanitize(byte[] input, byte[]? replacementCmap)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ private bool Escape(int op, InterpContext ctx)
? Pop(ctx.PostScriptStack)
: 0);
break;
case 6: // seac (accented char) not composed; ignore base for now
case 6: // seac (accented char) - not composed; ignore base for now
case 7: // sbw
case 0: // dotsection
case 1: // vstem3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Bit.BlazorUI;
/// <param name="TextLayerHtml">
/// The page's DOM part: the positioned page <c>div</c> containing the
/// <c>&lt;canvas&gt;</c> placeholder, the selectable text layer, and link/
/// annotation overlays everything except the painted content.
/// annotation overlays - everything except the painted content.
/// </param>
/// <param name="OpsJson">
/// The display list to replay onto the canvas (JSON array of drawing ops),
Expand Down
Loading
Loading